EventManager.hpp
1 #ifndef CPP3DS_EVENTMANAGER_HPP
2 #define CPP3DS_EVENTMANAGER_HPP
3 
4 #include <queue>
5 #include <cpp3ds/Window/Event.hpp>
6 #ifndef EMULATION
7 #include <3ds.h>
8 #endif
9 
10 namespace cpp3ds {
11 
12 class EventManager {
13 public:
14 
15  EventManager();
16 
40  bool pollEvent(Event& event);
41 
67  bool waitEvent(Event& event);
68 
76  void setJoystickThreshold(float threshold);
77 
78 private:
79 
94  bool popEvent(Event& event, bool block);
95 
106  void pushEvent(const Event& event);
107 
112  void processEvents();
113 
114  bool filterEvent(const Event& event);
115 
116  std::queue<Event> m_events;
117 // JoystickState m_joystickStates[Joystick::Count]; ///< Previous state of the joysticks
118  Vector3f m_sensorValue[Sensor::Count];
119  float m_joystickThreshold;
120  float m_slider3d;
121  float m_sliderVolume;
122  #ifndef EMULATION
123  touchPosition m_touch;
124  circlePosition m_circle;
125  u32 m_heldKeys;
126  #endif
127 };
128 
129 }
130 
131 
132 #endif
133 
134 
bool pollEvent(Event &event)
Pop the event on top of the event queue, if any, and return it.
cpp3ds::EventManager is used primarily by cpp3ds::Game for input/event management.
bool waitEvent(Event &event)
Wait for an event and return it.
Defines a system event and its parameters.
Definition: Event.hpp:15
Keep last – the total number of sensor types.
Definition: Sensor.hpp:27
void setJoystickThreshold(float threshold)
Change the joystick threshold, ie.