Class EventSystem

Class Documentation

class core::event::EventSystem

Public Functions

EventSystem()
~EventSystem()
void Update(unsigned int elapsed)

Will update all queue events. This method is not thread safe and should only getting called from one thread at a time.

Parameters
  • elapsed: Time since last update in milliseconds.

std::weak_ptr<Event> EnqueueEvent(const std::function<int()> &functionint timeout, )

Will enqueue a functions, the function will get called from the update thread.

Return

A weak reference to the created event.

Parameters
  • function: The function which will get called. The return value of the function is the time in milliseconds until the function will get called again. If the method returns zero the event will get cancelled.

  • timeout: Initial timeout in milliseconds, if the timeout is zero the event will called on the next update.

void CancelEvent(unsigned long id)

Cancel the given event. If the event doesn’t exists the method will have no effect.

Parameters
  • id: The unique id of the event.

void CancelEvent(const std::weak_ptr<Event> &event)

Cancel the given event. If the event doesn’t exists the method will have no effect.

Parameters
  • event: The reference to the event. If the reference is invalid this call will have no effect.