aboutsummaryrefslogtreecommitdiff
path: root/include/mglpp/window/Event.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'include/mglpp/window/Event.hpp')
-rw-r--r--include/mglpp/window/Event.hpp116
1 files changed, 115 insertions, 1 deletions
diff --git a/include/mglpp/window/Event.hpp b/include/mglpp/window/Event.hpp
index ecfb380..47718ff 100644
--- a/include/mglpp/window/Event.hpp
+++ b/include/mglpp/window/Event.hpp
@@ -1,10 +1,124 @@
#ifndef MGLPP_EVENT_HPP
#define MGLPP_EVENT_HPP
+#include "Keyboard.hpp"
+#include "Mouse.hpp"
+#include <stdint.h>
+
namespace mgl {
class Event {
public:
-
+ struct SizeEvent {
+ unsigned int width;
+ unsigned int height;
+ };
+
+ struct KeyEvent {
+ Keyboard::Key code;
+ bool alt;
+ bool control;
+ bool shift;
+ bool system;
+ };
+
+ struct TextEvent {
+ uint32_t unicode;
+ };
+
+ struct MouseMoveEvent {
+ int x;
+ int y;
+ };
+
+ 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;
+ };
+
+ enum EventType {
+ Closed,
+ Resized,
+ LostFocus,
+ GainedFocus,
+ TextEntered,
+ KeyPressed,
+ KeyReleased,
+ MouseWheelMoved,
+ MouseWheelScrolled,
+ MouseButtonPressed,
+ MouseButtonReleased,
+ MouseMoved,
+ MouseEntered,
+ MouseLeft,
+ JoystickButtonPressed,
+ JoystickButtonReleased,
+ JoystickMoved,
+ JoystickConnected,
+ JoystickDisconnected,
+ TouchBegan,
+ TouchMoved,
+ TouchEnded,
+ SensorChanged
+ };
+
+ 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;
+ };
};
}