diff options
| author | nathan <nathansmith@disroot.org> | 2025-11-21 11:27:12 +0000 |
|---|---|---|
| committer | nathan <nathansmith@disroot.org> | 2025-11-21 11:27:12 +0000 |
| commit | 52a58016c7217942ab06988cc9adacc6e76689ca (patch) | |
| tree | 7b2fc58d2f1f331c48a47096d1d3e809045374f0 /src/game.c | |
| parent | e00d5a923f69bd0b95b0ccf11d98f507fe6f08aa (diff) | |
| download | FindThings-52a58016c7217942ab06988cc9adacc6e76689ca.tar.gz FindThings-52a58016c7217942ab06988cc9adacc6e76689ca.tar.bz2 FindThings-52a58016c7217942ab06988cc9adacc6e76689ca.zip | |
cross hair and clear background thingy
Diffstat (limited to 'src/game.c')
| -rw-r--r-- | src/game.c | 32 |
1 files changed, 31 insertions, 1 deletions
@@ -112,7 +112,7 @@ void initGame(Game* game) 100.0, 100.0}); addWindowToWindowManager(&game->wm, window); - window = createFloatingWindow("test2", + window = createFloatingWindow("test2",\ (Rectangle){200.0, 200.0, 100.0, 100.0}); window.callback = testFloatingWindowCallback; addWindowToWindowManager(&game->wm, window); @@ -170,6 +170,29 @@ void drawGameScreen(Game* game) } } +void drawCrosshair(float crossHairSize, float crossHairThickness, Color color) +{ + float screenHalfWidth = GetRenderWidth() / 2.0; + float screenHalfHeight = GetRenderHeight() / 2.0; + float halfThickness = crossHairThickness / 2.0; + + // Vertical. + DrawLineEx( + (Vector2){screenHalfWidth - crossHairSize, + screenHalfHeight}, + (Vector2){screenHalfWidth + crossHairSize, + screenHalfHeight}, + crossHairThickness, color); + + // Horizontal. + DrawLineEx( + (Vector2){screenHalfWidth, + screenHalfHeight - crossHairSize}, + (Vector2){screenHalfWidth, + screenHalfHeight + crossHairSize}, + crossHairThickness, color); +} + void updateGameScene(Game* game) { // Handle toggle cursor. @@ -207,6 +230,13 @@ void updateGameScene(Game* game) drawGameScreen(game); updateWindowManager(&game->wm, game); + + if (!game->isCursorEnabled) + { + drawCrosshair(game->settings.crossHairSize, + game->settings.crossHairThickness, + game->settings.crossHairColor); + } } void handleGameResize(Game* game) |
