aboutsummaryrefslogtreecommitdiff
path: root/mwe/events/include/event.h
diff options
context:
space:
mode:
authorLoek Le Blansch <loek@pipeframe.xyz>2024-11-05 16:12:47 +0100
committerLoek Le Blansch <loek@pipeframe.xyz>2024-11-05 16:12:47 +0100
commite36ea050972fcaaf3d85d672755bad4ebb2dcd80 (patch)
tree5145e0b66650eea1df301106b7d197a586be65f3 /mwe/events/include/event.h
parent333b07775be1ef20fdb5909672c1e4dcabec1b40 (diff)
parentb770475741b7c33d57331f3139c55a3f237ad274 (diff)
merge `master` into `loek/savemgr`
Diffstat (limited to 'mwe/events/include/event.h')
-rw-r--r--mwe/events/include/event.h70
1 files changed, 69 insertions, 1 deletions
diff --git a/mwe/events/include/event.h b/mwe/events/include/event.h
index 730ee4b..16c75bf 100644
--- a/mwe/events/include/event.h
+++ b/mwe/events/include/event.h
@@ -6,7 +6,6 @@
#include <string>
#include <unordered_map>
#include <variant>
-
class UUIDGenerator {
public:
static std::uint32_t getUniqueID() {
@@ -63,7 +62,19 @@ public:
Keycode key = 0;
int repeatCount = 0;
};
+class MouseClickEvent : public Event {
+public:
+ MouseClickEvent(int x, int y, MouseButton button);
+ REGISTER_EVENT_TYPE("KeyClickedEvent");
+ std::pair<int, int> getMousePosition() const;
+ MouseButton getButton() const { return button; }
+
+private:
+ int mouseX = 0;
+ int mouseY = 0;
+ MouseButton button;
+};
// KeyReleasedEvent class
class KeyReleasedEvent : public Event {
public:
@@ -89,6 +100,33 @@ public:
private:
int mouseX = 0;
int mouseY = 0;
+ MouseButton button;
+};
+class MouseReleasedEvent : public Event {
+public:
+ MouseReleasedEvent(int mouseX, int mouseY, MouseButton button);
+
+ REGISTER_EVENT_TYPE(MouseReleasedEvent)
+
+ std::pair<int, int> getMousePosition() const;
+ MouseButton getMouseButton() const;
+
+private:
+ int mouseX = 0;
+ int mouseY = 0;
+ MouseButton button;
+};
+class MouseMovedEvent : public Event {
+public:
+ MouseMovedEvent(int mouseX, int mouseY);
+
+ REGISTER_EVENT_TYPE(MouseMovedEvent)
+
+ std::pair<int, int> getMousePosition() const;
+
+private:
+ int mouseX = 0;
+ int mouseY = 0;
};
class CollisionEvent : public Event {
public:
@@ -101,3 +139,33 @@ public:
private:
Collision collisionData;
};
+class TextSubmitEvent : public Event {
+public:
+ TextSubmitEvent(std::string submittedText);
+
+ REGISTER_EVENT_TYPE(TextSubmitEvent)
+
+ std::string getText() const;
+
+private:
+ std::string text;
+};
+class ShutDownEvent : public Event {
+public:
+ ShutDownEvent() : Event("ShutDownEvent") {};
+
+ REGISTER_EVENT_TYPE(ShutDownEvent)
+
+private:
+};
+// class ButtonClickEvent : public Event {
+// public:
+// ButtonClickEvent(int x,int y,int width,int height);
+
+// REGISTER_EVENT_TYPE(TextSubmitEvent)
+
+// std::string getText() const;
+
+// private:
+// std::string text;
+// };