aboutsummaryrefslogtreecommitdiff
path: root/mwe/events/include/event.h
diff options
context:
space:
mode:
authorLoek Le Blansch <loek@pipeframe.xyz>2024-11-04 08:31:05 +0100
committerLoek Le Blansch <loek@pipeframe.xyz>2024-11-04 08:31:05 +0100
commit63d50eea4e389e73e26f41452829dd48e6190c70 (patch)
tree82a8ef7a28fe7e069dbe9830adc28fd49dd85846 /mwe/events/include/event.h
parent06f65659fc6ffde7cabd2135040cbfbf089e5a24 (diff)
parent2585dc3cab48ccad0cfa0c63354662d656c86c46 (diff)
Merge branch 'master' of github.com:lonkaars/crepe
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;
+// };