aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/mglpp/window/Event.hpp105
-rw-r--r--include/mglpp/window/Keyboard.hpp4
-rw-r--r--include/mglpp/window/Mouse.hpp9
3 files changed, 25 insertions, 93 deletions
diff --git a/include/mglpp/window/Event.hpp b/include/mglpp/window/Event.hpp
index 47718ff..4c99379 100644
--- a/include/mglpp/window/Event.hpp
+++ b/include/mglpp/window/Event.hpp
@@ -5,119 +5,52 @@
#include "Mouse.hpp"
#include <stdint.h>
+/* These have to match the same structures in mgl event */
+
namespace mgl {
class Event {
public:
struct SizeEvent {
- unsigned int width;
- unsigned int height;
+ int width;
+ int height;
};
struct KeyEvent {
Keyboard::Key code;
- bool alt;
- bool control;
- bool shift;
- bool system;
- };
-
- struct TextEvent {
- uint32_t unicode;
+ bool alt;
+ bool control;
+ bool shift;
+ bool system;
};
struct MouseMoveEvent {
- int x;
- int y;
+ int x; /* relative to left of the window */
+ int y; /* relative to the top of the window */
};
struct MouseButtonEvent {
Mouse::Button button;
- int x;
- int y;
- };
-
- struct MouseWheelEvent {
- int delta;
- int x;
- int y;
- };
-
- struct MouseWheelScrollEvent {
- Mouse::Wheel wheel;
- float delta;
- int x;
- int y;
- };
-
- struct JoystickConnectEvent {
- unsigned int joystick_id;
- };
-
- struct JoystickMoveEvent {
- unsigned int joystick_id;
- /*Joystick::Axis axis;*/
- float position;
- };
-
- struct JoystickButtonEvent {
- unsigned int joystick_id;
- unsigned int button;
- };
-
- struct TouchEvent {
- unsigned int finger;
- int x;
- int y;
- };
-
- struct SensorEvent {
- /*Sensor::Type type;*/
- float x;
- float y;
- float z;
+ int x; /* relative to left of the window */
+ int y; /* relative to top of the window */
};
- enum EventType {
- Closed,
+ enum EventType : int {
+ Unknown,
Resized,
- LostFocus,
- GainedFocus,
- TextEntered,
KeyPressed,
KeyReleased,
- MouseWheelMoved,
- MouseWheelScrolled,
MouseButtonPressed,
MouseButtonReleased,
- MouseMoved,
- MouseEntered,
- MouseLeft,
- JoystickButtonPressed,
- JoystickButtonReleased,
- JoystickMoved,
- JoystickConnected,
- JoystickDisconnected,
- TouchBegan,
- TouchMoved,
- TouchEnded,
- SensorChanged
+ MouseMoved
};
EventType type;
union {
- SizeEvent size;
- KeyEvent key;
- TextEvent text;
- MouseMoveEvent mouse_move;
- MouseButtonEvent mouse_button;
- MouseWheelEvent mouse_wheel;
- MouseWheelScrollEvent mouse_wheel_scroll;
- JoystickMoveEvent joystick_move;
- JoystickButtonEvent joystick_button;
- JoystickConnectEvent joystick_connect;
- TouchEvent touch;
- SensorEvent sensor;
+ SizeEvent size;
+ KeyEvent key;
+ MouseButtonEvent mouse_button;
+ MouseMoveEvent mouse_move;
};
};
}
diff --git a/include/mglpp/window/Keyboard.hpp b/include/mglpp/window/Keyboard.hpp
index 2757871..b744143 100644
--- a/include/mglpp/window/Keyboard.hpp
+++ b/include/mglpp/window/Keyboard.hpp
@@ -4,7 +4,9 @@
namespace mgl {
class Keyboard {
public:
- enum Key {
+ /* Has to match mgl_key */
+ enum Key : int {
+ Unknown,
A,
B,
C,
diff --git a/include/mglpp/window/Mouse.hpp b/include/mglpp/window/Mouse.hpp
index d77659a..c53f076 100644
--- a/include/mglpp/window/Mouse.hpp
+++ b/include/mglpp/window/Mouse.hpp
@@ -4,18 +4,15 @@
namespace mgl {
class Mouse {
public:
- enum Button {
+ /* Has to match mgl_mouse_button */
+ enum Button : int {
+ Unknown,
Left,
Right,
Middle,
XButton1,
XButton2
};
-
- enum Wheel {
- VerticalWheel,
- HorizontalWheel
- };
};
}