From ba522d0b6e8172d2d9f0ee107fbb2d6499380847 Mon Sep 17 00:00:00 2001 From: nathansmith117 Date: Wed, 21 Feb 2024 10:42:07 -0700 Subject: Working on resizing thingy --- src/game.c | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) (limited to 'src/game.c') diff --git a/src/game.c b/src/game.c index cecca65..e74075f 100644 --- a/src/game.c +++ b/src/game.c @@ -3,6 +3,7 @@ void initGame(Game* game) { InitWindow(WINDOW_WIDTH, WINDOW_HEIGHT, "Penguin Yippies!"); + SetWindowState(FLAG_WINDOW_RESIZABLE); // Assets. initAssets(&game->assets); @@ -11,11 +12,14 @@ void initGame(Game* game) game->currentScreen = MAIN_MENU_SCREEN; initMainMenu(&game->mainMenu, game); initGameScreen(&game->gameScreen, game); + + game->screenTexture = LoadRenderTexture(WINDOW_WIDTH, WINDOW_HEIGHT); } void updateGame(Game* game) { - BeginDrawing(); + // Draw screen. + BeginTextureMode(game->screenTexture); switch (game->currentScreen) { @@ -29,6 +33,20 @@ void updateGame(Game* game) break; } + EndTextureMode(); + + // Draw the silly silly render texture. + BeginDrawing(); + + DrawTexturePro( + game->screenTexture.texture, + (Rectangle){0.0, 0.0, game->screenTexture.texture.width, -game->screenTexture.texture.height}, + (Rectangle){0.0, 0.0, GetScreenWidth(), GetScreenHeight()}, + Vector2Zero(), + 0.0, + WHITE + ); + EndDrawing(); } @@ -37,6 +55,7 @@ void closeGame(Game* game) closeAssets(&game->assets); closeMainMenu(&game->mainMenu); closeGameScreen(&game->gameScreen); + UnloadRenderTexture(game->screenTexture); CloseWindow(); } -- cgit v1.2.3