diff options
author | WBoerenkamps <wrj.boerenkamps@student.avans.nl> | 2024-12-20 12:17:14 +0100 |
---|---|---|
committer | WBoerenkamps <wrj.boerenkamps@student.avans.nl> | 2024-12-20 12:17:14 +0100 |
commit | 18c7e528f3df31d62cd05c2cc34be92be83d5367 (patch) | |
tree | 800cc0fc41750c31a95de09dc2fc2207d0ed7469 /src/crepe/system/InputSystem.cpp | |
parent | 03aea832aa0bc2edba2cc5ab4d9f8eba42d355be (diff) |
button now using channel
Diffstat (limited to 'src/crepe/system/InputSystem.cpp')
-rw-r--r-- | src/crepe/system/InputSystem.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/crepe/system/InputSystem.cpp b/src/crepe/system/InputSystem.cpp index 858a645..49ffeac 100644 --- a/src/crepe/system/InputSystem.cpp +++ b/src/crepe/system/InputSystem.cpp @@ -171,12 +171,12 @@ void InputSystem::handle_move(const EventData & event_data, const vec2 & mouse_p if (this->is_mouse_inside_button(mouse_pos, button, transform, cam_transform)) { button.hover = true; if (!was_hovering) { - event_mgr.trigger_event<ButtonEnterEvent>(metadata); + event_mgr.trigger_event<ButtonEnterEvent>(metadata,metadata.game_object_id); } } else { button.hover = false; if (was_hovering) { - event_mgr.trigger_event<ButtonExitEvent>(metadata); + event_mgr.trigger_event<ButtonExitEvent>(metadata,metadata.game_object_id); } } } @@ -196,7 +196,7 @@ void InputSystem::handle_click(const MouseButton & mouse_button, const vec2 & mo const Transform & transform = mgr.get_components_by_id<Transform>(button.game_object_id).front(); if (this->is_mouse_inside_button(mouse_pos, button, transform, cam_transform)) { - event_mgr.trigger_event<ButtonPressEvent>(metadata); + event_mgr.trigger_event<ButtonPressEvent>(metadata,metadata.game_object_id); } } } @@ -209,7 +209,7 @@ bool InputSystem::is_mouse_inside_button(const vec2 & mouse_pos, const Button & actual_pos += cam_transform.position; } vec2 half_dimensions = button.dimensions / 2; - + return mouse_pos.x >= actual_pos.x - half_dimensions.x && mouse_pos.x <= actual_pos.x + half_dimensions.x && mouse_pos.y >= actual_pos.y - half_dimensions.y |