aboutsummaryrefslogtreecommitdiff
path: root/src/crepe/api/Event.h
diff options
context:
space:
mode:
authorWBoerenkamps <wrj.boerenkamps@student.avans.nl>2024-11-16 13:55:47 +0100
committerWBoerenkamps <wrj.boerenkamps@student.avans.nl>2024-11-16 13:55:47 +0100
commit6e7003c73110cf9ad7e4c72de703dfdc2292d8ca (patch)
tree124818d404aab746cfd36a544f5c8241a4306b15 /src/crepe/api/Event.h
parent337a957a9e605f16287506b6afda56950e562db3 (diff)
added hpp files and auto
Diffstat (limited to 'src/crepe/api/Event.h')
-rw-r--r--src/crepe/api/Event.h94
1 files changed, 77 insertions, 17 deletions
diff --git a/src/crepe/api/Event.h b/src/crepe/api/Event.h
index 701ecdf..e7cac25 100644
--- a/src/crepe/api/Event.h
+++ b/src/crepe/api/Event.h
@@ -1,56 +1,116 @@
#pragma once
-#include "KeyCodes.h"
+
#include <iostream>
#include <string>
#include <typeindex>
+#include "KeyCodes.h"
+/**
+ * \brief Base class for all event types in the system.
+ */
class Event {
public:
};
+/**
+ * \brief Event triggered when a key is pressed.
+ */
class KeyPressEvent : public Event {
public:
- int repeat = 0;
- Keycode key = Keycode::NONE;
+ //! Number of times the key press is repeated (e.g., for long presses).
+ int repeat = 0;
+
+ //! The key that was pressed.
+ Keycode key = Keycode::NONE;
};
+/**
+ * \brief Event triggered when a key is released.
+ */
class KeyReleaseEvent : public Event {
public:
- Keycode key = Keycode::NONE;
+ //! The key that was released.
+ Keycode key = Keycode::NONE;
};
+/**
+ * \brief Event triggered when a mouse button is pressed.
+ */
class MousePressEvent : public Event {
public:
- int mouse_x = 0;
- int mouse_y = 0;
- MouseButton button = MouseButton::NONE;
+ //! X-coordinate of the mouse position at the time of the event.
+ int mouse_x = 0;
+
+ //! Y-coordinate of the mouse position at the time of the event.
+ int mouse_y = 0;
+
+ //! The mouse button that was pressed.
+ MouseButton button = MouseButton::NONE;
};
+/**
+ * \brief Event triggered when a mouse button is clicked (press and release).
+ */
class MouseClickEvent : public Event {
public:
- int mouse_x = 0;
- int mouse_y = 0;
- MouseButton button = MouseButton::NONE;
+ //! X-coordinate of the mouse position at the time of the event.
+ int mouse_x = 0;
+
+ //! Y-coordinate of the mouse position at the time of the event.
+ int mouse_y = 0;
+
+ //! The mouse button that was clicked.
+ MouseButton button = MouseButton::NONE;
};
+
+/**
+ * \brief Event triggered when a mouse button is released.
+ */
class MouseReleaseEvent : public Event {
public:
- int mouse_x = 0;
- int mouse_y = 0;
- MouseButton button = MouseButton::NONE;
+ //! X-coordinate of the mouse position at the time of the event.
+ int mouse_x = 0;
+
+ //! Y-coordinate of the mouse position at the time of the event.
+ int mouse_y = 0;
+
+ //! The mouse button that was released.
+ MouseButton button = MouseButton::NONE;
};
+
+/**
+ * \brief Event triggered when the mouse is moved.
+ */
class MouseMoveEvent : public Event {
public:
- int mouse_x = 0;
- int mouse_y = 0;
+ //! X-coordinate of the mouse position at the time of the event.
+ int mouse_x = 0;
+
+ //! Y-coordinate of the mouse position at the time of the event.
+ int mouse_y = 0;
};
+
+/**
+ * \brief Event triggered during a collision between objects.
+ */
class CollisionEvent : public Event {
public:
- //Collision collisionData;
+ //! Data describing the collision (currently not implemented).
+ // Collision collisionData;
};
+
+/**
+ * \brief Event triggered when text is submitted, e.g., from a text input.
+ */
class TextSubmitEvent : public Event {
public:
- std::string text = "";
+ //! The submitted text.
+ std::string text = "";
};
+
+/**
+ * \brief Event triggered to indicate the application is shutting down.
+ */
class ShutDownEvent : public Event {
public:
};