diff options
Diffstat (limited to 'src/crepe/system')
-rw-r--r-- | src/crepe/system/InputSystem.cpp | 7 | ||||
-rw-r--r-- | src/crepe/system/InputSystem.h | 9 |
2 files changed, 6 insertions, 10 deletions
diff --git a/src/crepe/system/InputSystem.cpp b/src/crepe/system/InputSystem.cpp index 72d728c..dca621e 100644 --- a/src/crepe/system/InputSystem.cpp +++ b/src/crepe/system/InputSystem.cpp @@ -11,11 +11,11 @@ void InputSystem::update() { std::vector<SDLContext::EventData> event_list = SDLContext::get_instance().get_events(); RefVector<Button> buttons = mgr.get_components_by_type<Button>(); RefVector<Camera> cameras = mgr.get_components_by_type<Camera>(); - + OptionalRef<Camera> curr_cam_ref; // Find the active camera for (Camera & cam : cameras) { if (!cam.active) continue; - this->curr_cam_ref = cam; + curr_cam_ref = cam; break; } if (!curr_cam_ref) return; @@ -123,8 +123,7 @@ void InputSystem::handle_move(const SDLContext::EventData & event_data, for (Button & button : buttons) { RefVector<Transform> transform_vec = mgr.get_components_by_id<Transform>(button.game_object_id); - OptionalRef<Transform> transform(transform_vec.front().get()); - if (!transform) continue; + Transform & transform(transform_vec.front().get()); bool was_hovering = button.hover; if (button.active diff --git a/src/crepe/system/InputSystem.h b/src/crepe/system/InputSystem.h index 53f2c4e..e65ad30 100644 --- a/src/crepe/system/InputSystem.h +++ b/src/crepe/system/InputSystem.h @@ -1,8 +1,8 @@ #pragma once -#include "facade/SDLContext.h" -#include "types.h" -#include "util/OptionalRef.h" +#include "../facade/SDLContext.h" +#include "../types.h" +#include "../util/OptionalRef.h" #include "System.h" @@ -30,9 +30,6 @@ public: void update() override; private: - //! Reference to the currently active camera. - OptionalRef<Camera> curr_cam_ref; - //! Stores the last position of the mouse when the button was pressed. std::pair<int, int> last_mouse_down_position{INFINITY, INFINITY}; |