aboutsummaryrefslogtreecommitdiff
path: root/mwe/events/src/event.cpp
diff options
context:
space:
mode:
authorheavydemon21 <nielsstunnebrink1@gmail.com>2024-11-18 14:27:58 +0100
committerheavydemon21 <nielsstunnebrink1@gmail.com>2024-11-18 14:27:58 +0100
commit03e493012edc106b00bc5676c1830ce2085a7ff9 (patch)
treeff06d4314552e82f98d08c52d7a15edb3a74436e /mwe/events/src/event.cpp
parent21f5b66d0bcc13d903800adf3bb614e380ff8591 (diff)
parent121b64b1cb6cfead5814070c8b0185d3d7308095 (diff)
Merge remote-tracking branch 'origin/master' into niels/sorting_rendering
Diffstat (limited to 'mwe/events/src/event.cpp')
-rw-r--r--mwe/events/src/event.cpp35
1 files changed, 9 insertions, 26 deletions
diff --git a/mwe/events/src/event.cpp b/mwe/events/src/event.cpp
index 8ffa0b1..0040c73 100644
--- a/mwe/events/src/event.cpp
+++ b/mwe/events/src/event.cpp
@@ -8,14 +8,11 @@ void Event::addArgument(const std::string & key,
eventData[key] = value;
}
-std::variant<int, std::string, float>
-Event::getArgument(const std::string & key) const {
+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::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; }
@@ -32,9 +29,7 @@ Keycode KeyPressedEvent::getKeyCode() const { return key; }
int KeyPressedEvent::getRepeatCount() const { return repeatCount; }
// KeyReleasedEvent class methods
-KeyReleasedEvent::KeyReleasedEvent(int keycode)
- : Event("KeyReleasedEvent"),
- key(keycode) {}
+KeyReleasedEvent::KeyReleasedEvent(int keycode) : Event("KeyReleasedEvent"), key(keycode) {}
Keycode KeyReleasedEvent::getKeyCode() const { return key; }
@@ -44,22 +39,16 @@ MousePressedEvent::MousePressedEvent(int mouseX, int mouseY)
mouseX(mouseX),
mouseY(mouseY) {}
-std::pair<int, int> MousePressedEvent::getMousePosition() const {
- return {mouseX, mouseY};
-}
+std::pair<int, int> MousePressedEvent::getMousePosition() const { return {mouseX, mouseY}; }
//Collision event
CollisionEvent::CollisionEvent(Collision collision)
: collisionData(collision),
Event("CollisionEvent") {}
-Collision CollisionEvent::getCollisionData() const {
- return this->collisionData;
-}
+Collision CollisionEvent::getCollisionData() const { return this->collisionData; }
-TextSubmitEvent::TextSubmitEvent(std::string text)
- : text(text),
- Event("TextSubmitEvent") {}
+TextSubmitEvent::TextSubmitEvent(std::string text) : text(text), Event("TextSubmitEvent") {}
std::string TextSubmitEvent::getText() const { return this->text; }
@@ -68,9 +57,7 @@ MouseReleasedEvent::MouseReleasedEvent(int x, int y, MouseButton button)
mouseY(y),
button(button),
Event("MouseReleased") {}
-std::pair<int, int> MouseReleasedEvent::getMousePosition() const {
- return {mouseX, mouseY};
-}
+std::pair<int, int> MouseReleasedEvent::getMousePosition() const { return {mouseX, mouseY}; }
MouseClickEvent::MouseClickEvent(int x, int y, MouseButton button)
: mouseX(x),
mouseY(y),
@@ -80,9 +67,5 @@ MouseMovedEvent::MouseMovedEvent(int x, int y)
: mouseX(x),
mouseY(y),
Event("MouseMovedEvent") {}
-std::pair<int, int> MouseClickEvent::getMousePosition() const {
- return {mouseX, mouseY};
-}
-std::pair<int, int> MouseMovedEvent::getMousePosition() const {
- return {mouseX, mouseY};
-}
+std::pair<int, int> MouseClickEvent::getMousePosition() const { return {mouseX, mouseY}; }
+std::pair<int, int> MouseMovedEvent::getMousePosition() const { return {mouseX, mouseY}; }