aboutsummaryrefslogtreecommitdiffstats
path: root/src/game.c
diff options
context:
space:
mode:
authornathan <nathansmith@disroot.org>2025-11-17 05:50:31 +0000
committernathan <nathansmith@disroot.org>2025-11-17 05:50:31 +0000
commitf6922dc12deb981cf95498afeb939f24171a5fc4 (patch)
tree4add44cdcdc1d4801d43cb4a557f7332fc6eef56 /src/game.c
parentfe39cc897fbc8d8470d790df5306550c841d95d4 (diff)
downloadFindThings-f6922dc12deb981cf95498afeb939f24171a5fc4.tar.gz
FindThings-f6922dc12deb981cf95498afeb939f24171a5fc4.tar.bz2
FindThings-f6922dc12deb981cf95498afeb939f24171a5fc4.zip
Testing widgets in the wm
Diffstat (limited to 'src/game.c')
-rw-r--r--src/game.c23
1 files changed, 17 insertions, 6 deletions
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)