From 10a0fb1c52a50b44bd2df064c977a3a15146facf Mon Sep 17 00:00:00 2001 From: nathansmithsmith Date: Wed, 8 Nov 2023 10:26:36 -0700 Subject: Fixed some stuff with the gui --- src/gameScreen.c | 14 ++++++++++---- src/gameScreen.h | 1 + 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/src/gameScreen.c b/src/gameScreen.c index e7c4a1d..82e96f2 100644 --- a/src/gameScreen.c +++ b/src/gameScreen.c @@ -21,10 +21,12 @@ void initGameScreenGui(GameScreen * gameScreen) { gameScreen->zoomViewPosition = (Vector2){width - GAME_SCREEN_ZOOM_VIEW_UI_SIZE - 20.0, 10.0}; gameScreen->killLogPosition = (Vector2){0.0, 40.0}; + + resetRadarPosition(&gameScreen->radar); + resetGyroscopePosition(&gameScreen->gyroscope); } void initGameScreen(Game * game, GameScreen * gameScreen) { - initGameScreenGui(gameScreen); // World render. if (game->settings.useWorldRenderTexture) { @@ -48,6 +50,8 @@ void initGameScreen(Game * game, GameScreen * gameScreen) { initRadar(&gameScreen->radar); initStars(&gameScreen->stars); + + initGameScreenGui(gameScreen); } void freeGameScreen(GameScreen * gameScreen) { @@ -332,12 +336,14 @@ void drawGameOverGameScreen(Game * game, GameScreen * gameScreen) { float width = GetScreenWidth(); float height = GetScreenHeight(); + const char * gameOverMsg = "Game Over"; + Vector2 position = (Vector2){ - width / 2.0, - height / 2.0 + width / 2.0 - ((sizeof(gameOverMsg) + 1) * (GAME_SCREEN_GAME_OVER_FONT_SIZE / 2.0) / 2.0), + height / 3.0 }; - DrawText("Game Over", position.x, position.y, 100, WHITE); + DrawText(gameOverMsg, position.x, position.y, GAME_SCREEN_GAME_OVER_FONT_SIZE, WHITE); } void resetGame(Game * game, GameScreen * gameScreen) { diff --git a/src/gameScreen.h b/src/gameScreen.h index 5bcd288..5890350 100644 --- a/src/gameScreen.h +++ b/src/gameScreen.h @@ -17,6 +17,7 @@ #define GAME_SCREEN_SKY_BOX_SIZE 1020.0 #define GAME_SCREEN_SHOW_GAME_OVER_FOR 2.0 +#define GAME_SCREEN_GAME_OVER_FONT_SIZE 100 // Gui stuff and shit. typedef struct GameScreen { -- cgit v1.2.3