diff options
author | heavydemon21 <nielsstunnebrink1@gmail.com> | 2024-11-18 15:08:31 +0100 |
---|---|---|
committer | heavydemon21 <nielsstunnebrink1@gmail.com> | 2024-11-18 15:08:31 +0100 |
commit | fee42c67918a9370f7f4e074dba9a677afccf90b (patch) | |
tree | c5ed200e3c584fafc4c6bd3df48adeed3cfbd31d /mwe/events/src/inputSystem.cpp | |
parent | ed1403aea4412bd479244eae8e2940190e71cd28 (diff) | |
parent | 121b64b1cb6cfead5814070c8b0185d3d7308095 (diff) |
Merge remote-tracking branch 'origin/master' into niels/RenderingParticle
Diffstat (limited to 'mwe/events/src/inputSystem.cpp')
-rw-r--r-- | mwe/events/src/inputSystem.cpp | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/mwe/events/src/inputSystem.cpp b/mwe/events/src/inputSystem.cpp index b87b12e..d740c9e 100644 --- a/mwe/events/src/inputSystem.cpp +++ b/mwe/events/src/inputSystem.cpp @@ -3,9 +3,7 @@ InputSystem::InputSystem() {} void InputSystem::registerButton(Button * button) { buttons.push_back(button); } -void InputSystem::registerTextInput(TextInput * input) { - textInputs.push_back(input); -} +void InputSystem::registerTextInput(TextInput * input) { textInputs.push_back(input); } void InputSystem::registerText(Text * label) { texts.push_back(label); } void InputSystem::processInput() { @@ -16,8 +14,7 @@ void InputSystem::processInput() { triggerEvent(ShutDownEvent()); break; case SDL_KEYDOWN: - triggerEvent( - KeyPressedEvent(getCustomKey(event.key.keysym.sym))); + triggerEvent(KeyPressedEvent(getCustomKey(event.key.keysym.sym))); processKeyPress(event.key.keysym.sym); break; case SDL_TEXTINPUT: @@ -37,15 +34,14 @@ void InputSystem::processInput() { void InputSystem::processMouseClick(int mouseX, int mouseY) { for (auto * button : buttons) { - if (mouseX >= button->x && mouseX <= (button->x + button->width) - && mouseY >= button->y && mouseY <= (button->y + button->height)) { + if (mouseX >= button->x && mouseX <= (button->x + button->width) && mouseY >= button->y + && mouseY <= (button->y + button->height)) { button->onClick(); } } for (auto * textInput : textInputs) { if (mouseX >= textInput->x && mouseX <= textInput->x + textInput->width - && mouseY >= textInput->y - && mouseY <= textInput->y + textInput->height) { + && mouseY >= textInput->y && mouseY <= textInput->y + textInput->height) { textInput->isActive = true; } else { textInput->isActive = false; |