aboutsummaryrefslogtreecommitdiffstats
path: root/src/game.c
diff options
context:
space:
mode:
authornathan <nathansmith@disroot.org>2025-12-22 01:17:44 +0000
committernathan <nathansmith@disroot.org>2025-12-22 01:17:44 +0000
commit2254600c6dfb50333327ddb94457427596b51807 (patch)
treec2a36d9c4433adbc5db763aa0e7d5863ce592740 /src/game.c
parent260d51b8399935c067eb79720db63e08d1c3f1f2 (diff)
downloadFindThings-2254600c6dfb50333327ddb94457427596b51807.tar.gz
FindThings-2254600c6dfb50333327ddb94457427596b51807.tar.bz2
FindThings-2254600c6dfb50333327ddb94457427596b51807.zip
Interaction menu stuff and fps adhd
Diffstat (limited to 'src/game.c')
-rw-r--r--src/game.c26
1 files changed, 19 insertions, 7 deletions
diff --git a/src/game.c b/src/game.c
index b2f2d32..7dbe9e8 100644
--- a/src/game.c
+++ b/src/game.c
@@ -52,6 +52,7 @@ void initGame(Game* game)
// Settings.
game->settings = defaultSettings();
game->isCrossHairEnabled = game->settings.isCrossHairEnabledDefault;
+ game->showFPS = game->settings.showFPSDefault;
// Window.
InitWindow(game->settings.windowWidth, game->settings.windowHeight,
@@ -85,8 +86,9 @@ void initGame(Game* game)
// Map.
initMap(&game->map, &game->world, &game->settings);
- // Interaction chat.
- initInteractionChat(&game->chat, &game->settings);
+ // Interaction chat and menu.
+ initInteractionChat(&game->interactionChat, &game->settings);
+ initInteractionMenu(&game->interactionMenu, &game->settings);
disableGameCursor(game);
}
@@ -220,10 +222,6 @@ void updateGameScene(Game* game)
drawGameScreen(game);
- updateMap(&game->map, game);
- updateGameEntityInfo(game);
- updateInteractionChat(&game->chat, game);
-
// Cross hair.
if (IsKeyPressed(game->settings.toggleCrossHairKey))
{
@@ -236,6 +234,11 @@ void updateGameScene(Game* game)
game->settings.crossHairThickness,
game->settings.crossHairColor);
}
+
+ updateMap(&game->map, game);
+ updateGameEntityInfo(game);
+ updateInteractionChat(&game->interactionChat, game);
+ updateInteractionMenu(&game->interactionMenu, game);
}
void handleGameResize(Game* game)
@@ -264,7 +267,16 @@ void updateGame(Game* game)
break;
}
- DrawFPS(0, 0);
+ // FPS stuff.
+ if (IsKeyPressed(game->settings.toggleFPSKey))
+ {
+ game->showFPS = !game->showFPS;
+ }
+
+ if (game->showFPS)
+ {
+ DrawFPS(0, 0);
+ }
EndDrawing();
}