From db181bafbe57e8df5f1df5c0871865701ac62ecc Mon Sep 17 00:00:00 2001 From: WBoerenkamps Date: Tue, 3 Dec 2024 12:39:41 +0100 Subject: make format --- src/crepe/api/Button.h | 1 - src/crepe/facade/SDLContext.cpp | 2 +- src/crepe/facade/SDLContext.h | 5 ++--- src/crepe/system/InputSystem.cpp | 43 ++++++++++++++++++++++------------------ src/crepe/system/InputSystem.h | 33 ++++++++++++++++-------------- src/test/InputTest.cpp | 31 ++++++++++++++++++----------- 6 files changed, 64 insertions(+), 51 deletions(-) diff --git a/src/crepe/api/Button.h b/src/crepe/api/Button.h index 0dfad5d..290bb2f 100644 --- a/src/crepe/api/Button.h +++ b/src/crepe/api/Button.h @@ -4,7 +4,6 @@ #include "UiObject.h" - namespace crepe { /** diff --git a/src/crepe/facade/SDLContext.cpp b/src/crepe/facade/SDLContext.cpp index 03b0cdc..a657373 100644 --- a/src/crepe/facade/SDLContext.cpp +++ b/src/crepe/facade/SDLContext.cpp @@ -16,8 +16,8 @@ #include #include "../api/Camera.h" -#include "../api/EventManager.h" #include "../api/Config.h" +#include "../api/EventManager.h" #include "../api/Sprite.h" #include "../api/Texture.h" #include "../util/Log.h" diff --git a/src/crepe/facade/SDLContext.h b/src/crepe/facade/SDLContext.h index a56232f..2228950 100644 --- a/src/crepe/facade/SDLContext.h +++ b/src/crepe/facade/SDLContext.h @@ -12,13 +12,12 @@ #include #include "api/Camera.h" +#include "api/Color.h" #include "api/Event.h" #include "api/KeyCodes.h" #include "api/Sprite.h" -#include "api/Transform.h" -#include "api/Camera.h" -#include "api/Color.h" #include "api/Texture.h" +#include "api/Transform.h" #include "types.h" namespace crepe { diff --git a/src/crepe/system/InputSystem.cpp b/src/crepe/system/InputSystem.cpp index 1cd3974..0cf5af1 100644 --- a/src/crepe/system/InputSystem.cpp +++ b/src/crepe/system/InputSystem.cpp @@ -6,7 +6,6 @@ using namespace crepe; - void InputSystem::update() { ComponentManager & mgr = this->component_manager; EventManager & event_mgr = EventManager::get_instance(); @@ -21,11 +20,14 @@ void InputSystem::update() { break; } if (!curr_cam_ref) return; - Camera& current_cam = curr_cam_ref; - RefVector transform_vec = mgr.get_components_by_id(current_cam.game_object_id); - Transform& cam_transform = transform_vec.front().get(); - int camera_origin_x = cam_transform.position.x + current_cam.offset.x - (current_cam.viewport_size.x / 2); - int camera_origin_y = cam_transform.position.y + current_cam.offset.y - (current_cam.viewport_size.y / 2); + Camera & current_cam = curr_cam_ref; + RefVector transform_vec + = mgr.get_components_by_id(current_cam.game_object_id); + Transform & cam_transform = transform_vec.front().get(); + int camera_origin_x + = cam_transform.position.x + current_cam.offset.x - (current_cam.viewport_size.x / 2); + int camera_origin_y + = cam_transform.position.y + current_cam.offset.y - (current_cam.viewport_size.y / 2); for (const SDLContext::EventData & event : event_list) { int world_mouse_x = event.mouse_position.first + camera_origin_x; int world_mouse_y = event.mouse_position.second + camera_origin_y; @@ -98,7 +100,8 @@ void InputSystem::update() { } } -void InputSystem::handle_move(const SDLContext::EventData & event_data, const int& world_mouse_x, const int& world_mouse_y) { +void InputSystem::handle_move(const SDLContext::EventData & event_data, + const int & world_mouse_x, const int & world_mouse_y) { ComponentManager & mgr = this->component_manager; RefVector