EventSystem Class
The EventSystem class provides an event system work.
The EventSystem class implementation can be found in the data/framework/game/event_system.h file.
EventSystem Class
Members
EventSystem ()
Constructor. Creates a new EventSystem class instance.void createEvent (string name)
Creates an event.Arguments
- string name - Unique event name.
void removeEvent (string name)
Deletes an event.Arguments
- string name - Unique event name.
int isEvent (string name)
Returns a value indicating if an event with a specified name exists.Arguments
- string name - Event name.
Return value
1 if an event exists; otherwise 0.void setEventEnabled (string name, int mode)
Sets a value indicating if an event enabled or disabled.Arguments
- string name - Event name.
- int mode - 1 to enable an event; 0 to disable it.
int isEventEnabled (string name)
Returns a value indicating if an event is enabled.Arguments
- string name - Event name.
Return value
1 if an event is enabled; otherwise 0.void callEvent (string name)
Calls an event.Arguments
- string name - Event name.
void callEvent (string name, Entity ret [])
Calls an event for the specified entities.Arguments
- string name - Event name.
- Entity ret [] - Array of entities.
void subscribe (string name, variable instance, string function, variable arg0 = 0, variable arg1 = 0, variable arg2 = 0, variable arg3 = 0)
Subscribes a function to an event.Arguments
- string name - Event name.
- variable instance - User class instance, for which the function is called. If the function is static, pass the NULL value.
- string function - Name of the function that is called when the event occures.
- variable arg0 - Function argument, optional.
- variable arg1 - Function argument, optional.
- variable arg2 - Function argument, optional.
- variable arg3 - Function argument, optional.
void unsubscribe (string name, variable instance, string function, int num_args = 0)
Unsubscribes a function from an event.Arguments
- string name - Event name.
- variable instance - User class instance, for which the function is called. If the function is static, pass the NULL value.
- string function - Name of the function.
- int num_args - Number of function arguments.
void clearGarbage ()
Releases an event system unused resources.Last update: 2017-07-03
Help improve this article
Was this article helpful?
(or select a word/phrase and press Ctrl+Enter)