Public Member Functions | List of all members
cpp3ds::EventManager Class Reference

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...
 

Detailed Description

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.

Member Function Documentation

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.

while (cpp3ds::pollEvent(event))
{
// process event...
}
Parameters
eventEvent to be returned
Returns
True if an event was returned, or false if the event queue was empty
See also
cpp3ds::waitEvent
void cpp3ds::EventManager::setJoystickThreshold ( float  threshold)

Change the joystick threshold, ie.

the value below which no move event will be generated

Parameters
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.

if (cpp3ds::waitEvent(event))
{
// process event...
}
Parameters
eventEvent to be returned
Returns
False if any error occured
See also
cpp3ds::pollEvent

The documentation for this class was generated from the following file: