From 2882e217aa5354a6befdddaa2de886f66ff40879 Mon Sep 17 00:00:00 2001 From: heavydemon21 Date: Sun, 22 Dec 2024 13:55:57 +0100 Subject: fixed some includes --- src/crepe/system/InputSystem.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/crepe/system/InputSystem.cpp') diff --git a/src/crepe/system/InputSystem.cpp b/src/crepe/system/InputSystem.cpp index b4a0633..a366d34 100644 --- a/src/crepe/system/InputSystem.cpp +++ b/src/crepe/system/InputSystem.cpp @@ -2,7 +2,7 @@ #include "../facade/SDLContext.h" #include "../manager/ComponentManager.h" #include "../manager/EventManager.h" -#include "util/Log.h" +#include "../api/Config.h" #include "InputSystem.h" @@ -213,7 +213,7 @@ bool InputSystem::is_mouse_inside_button( const Transform & cam_transform ) { vec2 actual_pos = transform.position + button.offset; - if (!button.world_space) { + if (!button.data.world_space) { actual_pos += cam_transform.position; } vec2 half_dimensions = button.dimensions / 2; -- cgit v1.2.3 From 76f6c4d3e36b653aec79438ae4053ea24560236c Mon Sep 17 00:00:00 2001 From: heavydemon21 Date: Sun, 22 Dec 2024 13:56:17 +0100 Subject: make format --- src/crepe/system/InputSystem.cpp | 2 +- src/crepe/system/InputSystem.h | 2 +- src/example/rendering_particle.cpp | 24 ++++++++++++++---------- 3 files changed, 16 insertions(+), 12 deletions(-) (limited to 'src/crepe/system/InputSystem.cpp') diff --git a/src/crepe/system/InputSystem.cpp b/src/crepe/system/InputSystem.cpp index a366d34..91c9c64 100644 --- a/src/crepe/system/InputSystem.cpp +++ b/src/crepe/system/InputSystem.cpp @@ -1,8 +1,8 @@ #include "../api/Button.h" +#include "../api/Config.h" #include "../facade/SDLContext.h" #include "../manager/ComponentManager.h" #include "../manager/EventManager.h" -#include "../api/Config.h" #include "InputSystem.h" diff --git a/src/crepe/system/InputSystem.h b/src/crepe/system/InputSystem.h index 21a3dfb..be62367 100644 --- a/src/crepe/system/InputSystem.h +++ b/src/crepe/system/InputSystem.h @@ -1,8 +1,8 @@ #pragma once -#include "../facade/EventData.h" #include "../api/Event.h" #include "../api/Metadata.h" +#include "../facade/EventData.h" #include "../types.h" #include "System.h" diff --git a/src/example/rendering_particle.cpp b/src/example/rendering_particle.cpp index 9093fd5..8be781a 100644 --- a/src/example/rendering_particle.cpp +++ b/src/example/rendering_particle.cpp @@ -62,18 +62,22 @@ public: } ); - game_object.add_component(vec2{1, 1}, vec2{0, -1}, "ComicSansMS", - Text::Data{ - .text_color = Color::RED, - }, - "test TEST"); + game_object.add_component( + vec2 {1, 1}, vec2 {0, -1}, "ComicSansMS", + Text::Data { + .text_color = Color::RED, + }, + "test TEST" + ); game_object - .add_component(vec2{1, 1}, vec2{0, 1}, "Ariel", - Text::Data{ - .text_color = Color::BLACK, - }, - "TEST test") + .add_component( + vec2 {1, 1}, vec2 {0, 1}, "Ariel", + Text::Data { + .text_color = Color::BLACK, + }, + "TEST test" + ) .world_space = true; } -- cgit v1.2.3 From 92dfde9a56f5a607269e8908002a72bec85357bd Mon Sep 17 00:00:00 2001 From: WBoerenkamps Date: Mon, 6 Jan 2025 10:50:01 +0100 Subject: bug fix --- src/crepe/system/InputSystem.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/crepe/system/InputSystem.cpp') diff --git a/src/crepe/system/InputSystem.cpp b/src/crepe/system/InputSystem.cpp index 91c9c64..d9c97a3 100644 --- a/src/crepe/system/InputSystem.cpp +++ b/src/crepe/system/InputSystem.cpp @@ -216,8 +216,8 @@ bool InputSystem::is_mouse_inside_button( if (!button.data.world_space) { actual_pos += cam_transform.position; } - vec2 half_dimensions = button.dimensions / 2; - + vec2 half_dimensions = button.dimensions * transform.scale / 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 -- cgit v1.2.3 From cc2ffe577ad93b126bf9cac6391e678eb54a07f5 Mon Sep 17 00:00:00 2001 From: WBoerenkamps Date: Mon, 6 Jan 2025 10:52:47 +0100 Subject: make format --- src/crepe/system/InputSystem.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/crepe/system/InputSystem.cpp') diff --git a/src/crepe/system/InputSystem.cpp b/src/crepe/system/InputSystem.cpp index d9c97a3..be7eda6 100644 --- a/src/crepe/system/InputSystem.cpp +++ b/src/crepe/system/InputSystem.cpp @@ -217,7 +217,7 @@ bool InputSystem::is_mouse_inside_button( actual_pos += cam_transform.position; } vec2 half_dimensions = button.dimensions * transform.scale / 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 -- cgit v1.2.3