From f6922dc12deb981cf95498afeb939f24171a5fc4 Mon Sep 17 00:00:00 2001 From: nathan Date: Sun, 16 Nov 2025 22:50:31 -0700 Subject: Testing widgets in the wm --- src/game.c | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) (limited to 'src/game.c') diff --git a/src/game.c b/src/game.c index a8c4d4a..36b1d94 100644 --- a/src/game.c +++ b/src/game.c @@ -45,6 +45,21 @@ void resetScreenScale(Game* game) } } +FocusCommand testFloatingWindowCallback(FloatingWindow* window, Game* game) +{ + DrawText("test", window->rect.x + 10, + window->rect.y + 10 + RAYGUI_WINDOWBOX_STATUSBAR_HEIGHT, 15, BLUE); + + if (GuiButton((Rectangle){window->rect.x + 10.0, window->rect.y + 50.0, + 40.0, 20.0}, "A")) + { + puts("hi"); + return DEMAND_FOCUS; + } + + return NO_FOCUS_ACTION; +} + void initGame(Game* game) { game->sceneId = GAME_SCENE; @@ -91,6 +106,7 @@ void initGame(Game* game) window = createFloatingWindow("test2", (Rectangle){200.0, 200.0, 100.0, 100.0}); + window.callback = testFloatingWindowCallback; addWindowToWindowManager(&game->wm, window); window = createFloatingWindow("test3", @@ -142,11 +158,6 @@ void drawGameScreen(Game* game) } } -void updateGameUI(Game* game) -{ - updateWindowManager(&game->wm); -} - void updateGameScene(Game* game) { // Handle toggle cursor. @@ -183,7 +194,7 @@ void updateGameScene(Game* game) drawGameScreen(game); - updateGameUI(game); + updateWindowManager(&game->wm, game); } void handleGameResize(Game* game) -- cgit v1.2.3