diff options
author | Loek Le Blansch <loek@pipeframe.xyz> | 2025-01-11 22:17:00 +0100 |
---|---|---|
committer | Loek Le Blansch <loek@pipeframe.xyz> | 2025-01-11 22:17:00 +0100 |
commit | 57a51aec9220b6f3874f6f930b1a71a59f5494e0 (patch) | |
tree | 5bf5245b45e6d03220f3653b98070e10ce3a0cd5 | |
parent | cc8add56f9b8f0a32e7ab35a63454fed81eaacba (diff) |
-rw-r--r-- | src/test/InputTest.cpp | 30 |
1 files changed, 23 insertions, 7 deletions
diff --git a/src/test/InputTest.cpp b/src/test/InputTest.cpp index 9a541a0..a1fe59a 100644 --- a/src/test/InputTest.cpp +++ b/src/test/InputTest.cpp @@ -216,7 +216,8 @@ TEST_F(InputTest, testButtonClick) { EXPECT_EQ(event.metadata.game_object_id, button_obj.id); return false; }); - auto & button = button_obj.add_component<Button>(vec2 {100, 100}, vec2 {0, 0}); + auto & button + = button_obj.add_component<Button>(vec2 {100, 100}, Button::Data {}, vec2 {0, 0}); bool hover = false; button.active = true; @@ -238,9 +239,14 @@ TEST_F(InputTest, buttonPositionCamera) { EXPECT_EQ(event.metadata.game_object_id, button_obj.id); return false; }); - auto & button = button_obj.add_component<Button>(vec2 {10, 10}, vec2 {0, 0}); + auto & button = button_obj.add_component<Button>( + vec2 {10, 10}, + Button::Data { + .world_space = false, + }, + vec2 {0, 0} + ); - button.world_space = false; bool hover = false; button.active = true; this->simulate_mouse_click(999, 999, SDL_BUTTON_LEFT); @@ -261,8 +267,13 @@ TEST_F(InputTest, buttonPositionWorld) { EXPECT_EQ(event.metadata.game_object_id, button_obj.id); return false; }); - auto & button = button_obj.add_component<Button>(vec2 {10, 10}, vec2 {0, 0}); - button.world_space = true; + auto & button = button_obj.add_component<Button>( + vec2 {10, 10}, + Button::Data { + .world_space = true, + }, + vec2 {0, 0} + ); bool hover = false; button.active = true; this->simulate_mouse_click(999, 999, SDL_BUTTON_LEFT); @@ -288,8 +299,13 @@ TEST_F(InputTest, testButtonHover) { EXPECT_EQ(event.metadata.game_object_id, button_obj.id); return false; }); - auto & button = button_obj.add_component<Button>(vec2 {100, 100}, vec2 {0, 0}); - button.active = true; + auto & button = button_obj.add_component<Button>( + vec2 {100, 100}, + Button::Data { + .world_space = true, + }, + vec2 {0, 0} + ); // Mouse on button SDL_Event hover_event; SDL_zero(hover_event); |