aboutsummaryrefslogtreecommitdiff
path: root/src/crepe/system/InputSystem.cpp
diff options
context:
space:
mode:
authorWBoerenkamps <wrj.boerenkamps@student.avans.nl>2024-12-04 21:50:00 +0100
committerWBoerenkamps <wrj.boerenkamps@student.avans.nl>2024-12-04 21:50:00 +0100
commitd10f220ff6c5d62bb51793a0ef4ee37090161d89 (patch)
treeb709844a2fd689314d096cf0de72107a426c27f9 /src/crepe/system/InputSystem.cpp
parentc1f30c168fc95818ea75660d90c395b0a548412e (diff)
feedback changes
Diffstat (limited to 'src/crepe/system/InputSystem.cpp')
-rw-r--r--src/crepe/system/InputSystem.cpp6
1 files changed, 1 insertions, 5 deletions
diff --git a/src/crepe/system/InputSystem.cpp b/src/crepe/system/InputSystem.cpp
index 8fe583f..afd71fe 100644
--- a/src/crepe/system/InputSystem.cpp
+++ b/src/crepe/system/InputSystem.cpp
@@ -153,7 +153,7 @@ void InputSystem::handle_click(const MouseButton & mouse_button, const int world
for (Button & button : buttons) {
RefVector<Transform> transform_vec
= mgr.get_components_by_id<Transform>(button.game_object_id);
- Transform & transform(transform_vec.front().get());
+ Transform & transform = transform_vec.front().get();
if (button.active
&& this->is_mouse_inside_button(world_mouse_x, world_mouse_y, button, transform)) {
@@ -176,16 +176,12 @@ bool InputSystem::is_mouse_inside_button(const int mouse_x, const int mouse_y,
}
void InputSystem::handle_button_press(Button & button) {
- //checks if the button is a toggle button
if (button.is_toggle) {
- //if the toggle button is not in a pressed state and it has a on_click call the on_click
if (!button.is_pressed && button.on_click) {
button.on_click();
}
- //toggle the pressed state
button.is_pressed = !button.is_pressed;
} else if (button.on_click) {
- // if the button is not a toggle button and has a on_click call the on_click
button.on_click();
}
}