Event.hpp
1 #ifndef CPP3DS_EVENT_HPP
2 #define CPP3DS_EVENT_HPP
3 
4 #include <cpp3ds/Config.hpp>
5 #include <cpp3ds/Window/Joystick.hpp>
6 #include <cpp3ds/Window/Keyboard.hpp>
7 #include <cpp3ds/Window/Sensor.hpp>
8 
9 
10 namespace cpp3ds {
15 class Event {
16 public :
17 
22  struct KeyEvent {
24  };
25 
31  int x;
32  int y;
33  };
34 
39  struct TouchEvent {
40  int x;
41  int y;
42  };
43 
48  struct SensorEvent {
50  float x;
51  float y;
52  float z;
53  };
54 
59  struct SliderEvent {
60  float value;
61  };
62 
67  enum EventType {
74  TouchSwiped,
76  Slider3DChanged,
77  SliderVolumeChanged,
78 
80  };
81 
83  // Member data
86 
87  union {
92  SliderEvent slider;
93  };
94 };
95 
96 }
97 
98 
99 #endif
100 
101 
A touch event began (data in event.touch)
Definition: Event.hpp:71
Type
Sensor type.
Definition: Sensor.hpp:19
JoystickMoveEvent joystickMove
Joystick move event parameters (Event::JoystickMoved)
Definition: Event.hpp:89
A key was pressed (data in event.key)
Definition: Event.hpp:68
Joystick axis move event parameters (JoystickMoved)
Definition: Event.hpp:30
Sensor::Type type
Type of the sensor.
Definition: Event.hpp:49
float z
Current value of the sensor on Z axis.
Definition: Event.hpp:52
Keep last – the total number of event types.
Definition: Event.hpp:79
Key
Key codes.
Definition: Keyboard.hpp:21
KeyEvent key
Key event parameters (Event::KeyPressed, Event::KeyReleased)
Definition: Event.hpp:88
int x
New position on the x-axis (in range [-100 .. 100])
Definition: Event.hpp:31
Keyboard event parameters (KeyPressed, KeyReleased)
Definition: Event.hpp:22
Touch events parameters (TouchBegan, TouchMoved, TouchEnded)
Definition: Event.hpp:39
Slider event parameters (Slider3DChanged, SliderVolumeChanged)
Definition: Event.hpp:59
Sensor event parameters (SensorChanged)
Definition: Event.hpp:48
int y
Y position of the touch, relative to the top of the owner window.
Definition: Event.hpp:41
float y
Current value of the sensor on Y axis.
Definition: Event.hpp:51
int y
New position on the y-axis (in range [-100 .. 100])
Definition: Event.hpp:32
EventType type
Type of the event.
Definition: Event.hpp:85
SensorEvent sensor
Sensor event parameters (Event::SensorChanged)
Definition: Event.hpp:91
The joystick moved along an axis (data in event.joystickMove)
Definition: Event.hpp:70
A touch event ended (data in event.touch)
Definition: Event.hpp:73
float x
Current value of the sensor on X axis.
Definition: Event.hpp:50
float value
Current value of the slider [0-1] range.
Definition: Event.hpp:60
Defines a system event and its parameters.
Definition: Event.hpp:15
A key was released (data in event.key)
Definition: Event.hpp:69
A sensor value changed (data in event.sensor)
Definition: Event.hpp:75
EventType
Enumeration of the different types of events.
Definition: Event.hpp:67
int x
X position of the touch, relative to the left of the owner window.
Definition: Event.hpp:40
A touch moved (data in event.touch)
Definition: Event.hpp:72
Keyboard::Key code
Code of the key(s) that has been pressed.
Definition: Event.hpp:23
TouchEvent touch
Touch events parameters (Event::TouchBegan, Event::TouchMoved, Event::TouchEnded) ...
Definition: Event.hpp:90