From 52a58016c7217942ab06988cc9adacc6e76689ca Mon Sep 17 00:00:00 2001 From: nathan Date: Fri, 21 Nov 2025 04:27:12 -0700 Subject: cross hair and clear background thingy --- src/game.c | 32 +++++++++++++++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-) (limited to 'src/game.c') diff --git a/src/game.c b/src/game.c index 4818e79..4ada5de 100644 --- a/src/game.c +++ b/src/game.c @@ -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) -- cgit v1.2.3