diff options
-rw-r--r-- | src/game.c | 21 | ||||
-rw-r--r-- | src/game.h | 3 | ||||
-rw-r--r-- | src/gameCommon.h | 4 | ||||
-rw-r--r-- | src/gameScreen.c | 6 | ||||
-rw-r--r-- | src/mainMenu.c | 4 |
5 files changed, 30 insertions, 8 deletions
@@ -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(); } @@ -18,6 +18,9 @@ typedef struct Game { ScreenId currentScreen; MainMenu mainMenu; GameScreen gameScreen; + + // Wacky little render texture to make it look more like a unity game lmao. + RenderTexture screenTexture; } Game; void initGame(Game* game); diff --git a/src/gameCommon.h b/src/gameCommon.h index 1a9edea..ceca8b8 100644 --- a/src/gameCommon.h +++ b/src/gameCommon.h @@ -6,8 +6,8 @@ #include <raylib.h> #include <raymath.h> -#define WINDOW_WIDTH 1366 -#define WINDOW_HEIGHT 768 +#define WINDOW_WIDTH 1280 +#define WINDOW_HEIGHT 720 #ifndef GAME_COMMON_H #define GAME_COMMON_H diff --git a/src/gameScreen.c b/src/gameScreen.c index 005becc..dc14bc1 100644 --- a/src/gameScreen.c +++ b/src/gameScreen.c @@ -5,8 +5,8 @@ void initGameScreen(GameScreen* gameScreen, Game* game) { Assets* assets = &game->assets; - int width = GetScreenWidth(); - int height = GetScreenHeight(); + int width = WINDOW_WIDTH; + int height = WINDOW_HEIGHT; int navigationButtonSize = 100; int navigationButtonX = width - navigationButtonSize - 5.0; @@ -33,7 +33,7 @@ void initGameScreen(GameScreen* gameScreen, Game* game) Texture* buttonTexture = &gameScreen->buttonPanelSharedAnimation.texture; int buttonWidth = width / 4; - int buttonHeight = buttonWidth / 2.0; + int buttonHeight = buttonWidth / 2; int buttonY = height - buttonHeight; gameScreen->upgradesButton = createTexturedButton( diff --git a/src/mainMenu.c b/src/mainMenu.c index f64c2be..4968ee7 100644 --- a/src/mainMenu.c +++ b/src/mainMenu.c @@ -14,8 +14,8 @@ void initMainMenu(MainMenu* mainMenu, Game* game) Texture* startButtonTexture = &mainMenu->startButtonAnimation.texture; - int width = GetScreenWidth(); - int height = GetScreenHeight(); + int width = WINDOW_WIDTH; + int height = WINDOW_HEIGHT; mainMenu->startButton = createTexturedButton( startButtonTexture, |