diff options
author | WBoerenkamps <wrj.boerenkamps@student.avans.nl> | 2024-10-28 11:06:21 +0100 |
---|---|---|
committer | WBoerenkamps <wrj.boerenkamps@student.avans.nl> | 2024-10-28 11:06:21 +0100 |
commit | 29f9a26046e35c7eb0157df92757ce8e39f1ec74 (patch) | |
tree | 18be4912561c2fcc9a57b99466c74977e11f2abf /mwe/events/include/event.h | |
parent | f1b2c5a38f49bb319babf11bf64c420a63e104f2 (diff) |
iMouseListener and iKeyListener implementation
Diffstat (limited to 'mwe/events/include/event.h')
-rw-r--r-- | mwe/events/include/event.h | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/mwe/events/include/event.h b/mwe/events/include/event.h index 0208085..8968c6c 100644 --- a/mwe/events/include/event.h +++ b/mwe/events/include/event.h @@ -64,7 +64,20 @@ public: Keycode key = 0; int repeatCount = 0; }; +class MouseClickEvent : public Event { +public: + MouseClickEvent(int x, int y, MouseButton button); + + REGISTER_EVENT_TYPE("KeyClickedEvent"); + int getX() const { return x; } + int getY() const { return y; } + MouseButton getButton() const { return button; } +private: + int x; + int y; + MouseButton button; +}; // KeyReleasedEvent class class KeyReleasedEvent : public Event { public: @@ -90,6 +103,31 @@ 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: @@ -103,3 +141,16 @@ private: Collision collisionData; }; +class TextSubmitEvent : public Event { +public: + TextSubmitEvent(std::string submittedText); + + REGISTER_EVENT_TYPE(TextSubmitEvent) + + std::string getText() const { + return text; + } + +private: + std::string text; +}; |