- cpp3ds
- EventManager
cpp3ds::EventManager is used primarily by cpp3ds::Game for input/event management. More...
#include <EventManager.hpp>
Public Member Functions | |
bool | pollEvent (Event &event) |
Pop the event on top of the event queue, if any, and return it. More... | |
bool | waitEvent (Event &event) |
Wait for an event and return it. More... | |
void | setJoystickThreshold (float threshold) |
Change the joystick threshold, ie. More... | |
cpp3ds::EventManager is used primarily by cpp3ds::Game for input/event management.
Only useful for those planning on reimplementing cpp3ds::Game for customized needs.
Definition at line 12 of file EventManager.hpp.
bool cpp3ds::EventManager::pollEvent | ( | Event & | event | ) |
Pop the event on top of the event queue, if any, and return it.
This function is not blocking: if there's no pending event then it will return false and leave event unmodified. Note that more than one event may be present in the event queue, thus you should always call this function in a loop to make sure that you process every pending event.
event | Event to be returned |
void cpp3ds::EventManager::setJoystickThreshold | ( | float | threshold | ) |
Change the joystick threshold, ie.
the value below which no move event will be generated
threshold | : New threshold, in range [0, 100] |
bool cpp3ds::EventManager::waitEvent | ( | Event & | event | ) |
Wait for an event and return it.
This function is blocking: if there's no pending event then it will wait until an event is received. After this function returns (and no error occured), the event object is always valid and filled properly. This function is typically used when you have a thread that is dedicated to events handling: you want to make this thread sleep as long as no new event is received.
event | Event to be returned |