aboutsummaryrefslogtreecommitdiff
path: root/mwe/events/src/event.cpp
diff options
context:
space:
mode:
authorWBoerenkamps <wrj.boerenkamps@student.avans.nl>2024-10-25 20:59:34 +0200
committerWBoerenkamps <wrj.boerenkamps@student.avans.nl>2024-10-25 20:59:34 +0200
commit15a4c4a1cf67e13be53ef423c51c56488f332ea9 (patch)
tree661084fc8171089ce32bf779f2b3a85d634b38e4 /mwe/events/src/event.cpp
parentf472e0ba3bf54fc5055cf9f08925bed3f98a1dbc (diff)
parentb3b762a34e7ccb4a0dcd041a693ac7180af16002 (diff)
merge conficts fixed
Diffstat (limited to 'mwe/events/src/event.cpp')
-rw-r--r--mwe/events/src/event.cpp48
1 files changed, 18 insertions, 30 deletions
diff --git a/mwe/events/src/event.cpp b/mwe/events/src/event.cpp
index e4c046f..38ff62a 100644
--- a/mwe/events/src/event.cpp
+++ b/mwe/events/src/event.cpp
@@ -1,58 +1,46 @@
#include "event.h"
#include "keyCodes.h"
// Event class methods
-Event::Event(std::string eventType) {
- eventData["eventType"] = eventType;
-}
+Event::Event(std::string eventType) { eventData["eventType"] = eventType; }
-void Event::addArgument(const std::string& key, const std::variant<int, std::string, float>& value) {
- eventData[key] = value;
+void Event::addArgument(const std::string & key,
+ const std::variant<int, std::string, float> & value) {
+ eventData[key] = value;
}
-std::variant<int, std::string, float> Event::getArgument(const std::string& key) const {
- return eventData.at(key);
+std::variant<int, std::string, float>
+Event::getArgument(const std::string & key) const {
+ return eventData.at(key);
}
std::string Event::getType() const {
- return std::get<std::string>(eventData.at("eventType"));
-}
-std::string Event::toString() const {
- return std::to_string(getEventType());
-}
-bool Event::getHandled() const {
- return isHandled;
+ return std::get<std::string>(eventData.at("eventType"));
}
+std::string Event::toString() const { return std::to_string(getEventType()); }
+bool Event::getHandled() const { return isHandled; }
-void Event::markHandled() {
- isHandled = true;
-}
+void Event::markHandled() { isHandled = true; }
// KeyPressedEvent class methods
KeyPressedEvent::KeyPressedEvent(int keycode)
- : Event("KeyPressedEvent"), key(keycode), repeatCount(0) {}
+ : Event("KeyPressedEvent"), key(keycode), repeatCount(0) {}
-Keycode KeyPressedEvent::getKeyCode() const {
- return key;
-}
+Keycode KeyPressedEvent::getKeyCode() const { return key; }
-int KeyPressedEvent::getRepeatCount() const {
- return repeatCount;
-}
+int KeyPressedEvent::getRepeatCount() const { return repeatCount; }
// KeyReleasedEvent class methods
KeyReleasedEvent::KeyReleasedEvent(int keycode)
- : Event("KeyReleasedEvent"), key(keycode) {}
+ : Event("KeyReleasedEvent"), key(keycode) {}
-Keycode KeyReleasedEvent::getKeyCode() const {
- return key;
-}
+Keycode KeyReleasedEvent::getKeyCode() const { return key; }
// MousePressedEvent class methods
MousePressedEvent::MousePressedEvent(int mouseX, int mouseY)
- : Event("MousePressedEvent"), mouseX(mouseX), mouseY(mouseY) {}
+ : Event("MousePressedEvent"), mouseX(mouseX), mouseY(mouseY) {}
std::pair<int, int> MousePressedEvent::getMousePosition() const {
- return {mouseX, mouseY};
+ return {mouseX, mouseY};
}
//Collision event