|
stmm-games-doc
0.32.0
|

Classes | |
| struct | Init |
| struct | LocalInit |
Public Types | |
| enum | MESSAGE_OP_TYPE_ENUM { MESSAGE_SET_VALUE = 100, MESSAGE_RESET = 101, MESSAGE_ADD_VALUE = 110, MESSAGE_ADD_PERC_VALUE = 111, MESSAGE_MUL_BY_VALUE = 112, MESSAGE_NEG_ADD_VALUE = 115, MESSAGE_INC = 116, MESSAGE_SUB_VALUE = 120, MESSAGE_SUB_PERC_VALUE = 121, MESSAGE_DIV_BY_VALUE = 122, MESSAGE_NEG_SUB_VALUE = 125, MESSAGE_DEC = 126, MESSAGE_MIN_VALUE = 150, MESSAGE_MAX_VALUE = 151, MESSAGE_VAR_GET_VALUE = 200 } |
| enum | { LISTENER_GROUP_VAR_CHANGED = 10, LISTENER_GROUP_VAR_VALUE = 20 } |
Public Types inherited from stmg::Event | |
| enum | MSG_FILTER_VALUE_OP { MSG_FILTER_VALUE_OP_FIRST = 0, MSG_FILTER_VALUE_OP_UNCHANGED = 0, MSG_FILTER_VALUE_OP_SET = 1, MSG_FILTER_VALUE_OP_MULT_ADD = 2, MSG_FILTER_VALUE_OP_DIV_ADD = 3, MSG_FILTER_VALUE_OP_PERCENT_ADD = 4, MSG_FILTER_VALUE_OP_PERMILL_ADD = 5, MSG_FILTER_VALUE_OP_MOD_ADD = 6, MSG_FILTER_VALUE_OP_MIN_ADD = 7, MSG_FILTER_VALUE_OP_MAX_ADD = 8, MSG_FILTER_VALUE_OP_LAST = 8 } |
| Value filter. More... | |
| enum | { LISTENER_GROUP_FINISHED = 0 } |
Public Member Functions | |
| VariableEvent (Init &&oInit) noexcept | |
| Constructor. More... | |
| void | trigger (int32_t nMsg, int32_t nValue, Event *p0TriggeringEvent) noexcept override |
| The triggered function. More... | |
Public Member Functions inherited from stmg::Event | |
| virtual | ~Event () noexcept=default |
| virtual void | addMsgFilter (int32_t nInFromMsg, int32_t nInToMsg, int32_t nInFromValue, int32_t nInToValue, bool bOutMsgDefined, int32_t nOutMsg, MSG_FILTER_VALUE_OP eOutValueOperator, int32_t nOutValueOperand, int32_t nOutValueAdd) noexcept |
| Add a message filter. More... | |
| virtual void | addListener (int32_t nGroupId, Event *p0ListenerEvent, int32_t nMsg) noexcept |
| Adds a listener to the event. More... | |
| bool | isActive () const noexcept |
| Tells whether the event is active. More... | |
| int32_t | getTriggerTime () const noexcept |
| The triggering time. More... | |
| int32_t | getPriority () const noexcept |
| The priority. More... | |
| int32_t | getDebugTag () const noexcept |
| The debug tag. More... | |
Protected Member Functions | |
| void | reInit (Init &&oInit) noexcept |
| Reinitialization. More... | |
Protected Member Functions inherited from stmg::Event | |
| Event (Init &&oInit) noexcept | |
| Constructor. More... | |
| void | reInit (Init &&oInit) noexcept |
| Reinitialization. More... | |
| virtual void | informListeners (int32_t nGroupId, int32_t nValue) noexcept |
| Calls the trigger function of a group of listeners. More... | |
| const Level & | level () const noexcept |
| The level this event belongs to. More... | |
| Level & | level () noexcept |
| The level this event belongs to. More... | |
Variable event.
Instances of this class are associated with a specific variable and by triggering them they can change its value.
If the variable is time relative the event activates itself for the next game tick automatically and LISTENER_GROUP_VAR_CHANGED is sent if necessary. If it isn't time relative you need to trigger the event for it to send a message to LISTENER_GROUP_VAR_CHANGED listeners. One way to do it is by sending MESSAGE_ADD_VALUE with value 0.
| anonymous enum |
| Enumerator | |
|---|---|
| MESSAGE_SET_VALUE | Variable is set to nValue. |
| MESSAGE_RESET | Variable is set to 0. |
| MESSAGE_ADD_VALUE | trigger()'s nValue is added to the variable. |
| MESSAGE_ADD_PERC_VALUE | trigger()'s nValue% (percent) is added to the variable. |
| MESSAGE_MUL_BY_VALUE | The variable is multiplied by trigger()'s nValue. |
| MESSAGE_NEG_ADD_VALUE | trigger()'s nValue is added to the negated variable. |
| MESSAGE_INC | Variable is incremented. |
| MESSAGE_SUB_VALUE | trigger()'s nValue is subtracted from the variable. |
| MESSAGE_SUB_PERC_VALUE | trigger()'s nValue% (percent) is subtracted from the variable. |
| MESSAGE_DIV_BY_VALUE | The variable is divided by trigger()'s nValue. Division by 0 is 0. |
| MESSAGE_NEG_SUB_VALUE | trigger()'s nValue is subtracted to the negated variable. |
| MESSAGE_DEC | Variable is decremented. |
| MESSAGE_MIN_VALUE | Variable is set to min(nValue, current value). |
| MESSAGE_MAX_VALUE | Variable is set to max(nValue, current value). |
| MESSAGE_VAR_GET_VALUE | The variable is unchanged and just output by LISTENER_GROUP_VAR_VALUE. |
|
explicitnoexcept |
Constructor.
| oInit | The initialization data. |
|
protectednoexcept |
Reinitialization.
| oInit | The initialization data. |
|
overridevirtualnoexcept |
The triggered function.
| nMsg | If one MESSAGE_OP_TYPE_ENUM then operation is performed otherwise nDefaultIncBy (see constructor). |
| nValue | The triggered add value. Is only used if nMsg is MESSAGE_OP_TYPE_ENUM. |
| p0TriggeringEvent | The triggering event or null if event activated itself. |
Implements stmg::Event.
1.8.13