aboutsummaryrefslogtreecommitdiff
path: root/src/crepe/system/InputSystem.cpp
diff options
context:
space:
mode:
authorWBoerenkamps <wrj.boerenkamps@student.avans.nl>2024-11-27 14:46:56 +0100
committerWBoerenkamps <wrj.boerenkamps@student.avans.nl>2024-11-27 14:46:56 +0100
commit8554de0ebd75aea3c4b25d2fc211ad3a904f741b (patch)
treeeea2d04de123e560f3c6b69fea0f4ef3f4f86c68 /src/crepe/system/InputSystem.cpp
parente8b93d0ffaccf523139f75ff9b9dc43647e90746 (diff)
added RefVector
Diffstat (limited to 'src/crepe/system/InputSystem.cpp')
-rw-r--r--src/crepe/system/InputSystem.cpp11
1 files changed, 5 insertions, 6 deletions
diff --git a/src/crepe/system/InputSystem.cpp b/src/crepe/system/InputSystem.cpp
index 590be8d..dc5efff 100644
--- a/src/crepe/system/InputSystem.cpp
+++ b/src/crepe/system/InputSystem.cpp
@@ -89,9 +89,8 @@ void InputSystem::update() {
void InputSystem::handle_move(const SDLContext::EventData & event_data) {
ComponentManager & mgr = this->component_manager;
- std::vector<std::reference_wrapper<Button>> buttons = mgr.get_components_by_type<Button>();
- std::vector<std::reference_wrapper<Transform>> transforms
- = mgr.get_components_by_type<Transform>();
+ RefVector<Button> buttons = mgr.get_components_by_type<Button>();
+ RefVector<Transform> transforms = mgr.get_components_by_type<Transform>();
for (Button & button : buttons) {
OptionalRef<Transform> transform = find_transform_for_button(button, transforms);
@@ -108,8 +107,8 @@ void InputSystem::handle_move(const SDLContext::EventData & event_data) {
void InputSystem::handle_click(const SDLContext::EventData & event_data) {
ComponentManager & mgr = this->component_manager;
- std::vector<std::reference_wrapper<Button>> buttons = mgr.get_components_by_type<Button>();
- std::vector<std::reference_wrapper<Transform>> transforms = mgr.get_components_by_type<Transform>();
+ RefVector<Button> buttons = mgr.get_components_by_type<Button>();
+ RefVector<Transform> transforms = mgr.get_components_by_type<Transform>();
for (Button & button : buttons) {
OptionalRef<Transform> transform_ref = find_transform_for_button(button, transforms);
@@ -122,7 +121,7 @@ void InputSystem::handle_click(const SDLContext::EventData & event_data) {
OptionalRef<Transform> InputSystem::find_transform_for_button(
- Button & button, std::vector<std::reference_wrapper<Transform>> & transforms) {
+ Button & button, RefVector<Transform>& transforms) {
for (auto& transform : transforms) {
if (button.game_object_id == transform.get().game_object_id) {