diff options
| author | nathan <nathansmith@disroot.org> | 2025-12-22 10:26:45 +0000 |
|---|---|---|
| committer | nathan <nathansmith@disroot.org> | 2025-12-22 10:26:45 +0000 |
| commit | bdeb4f943fc351daeec22b4ef71d551342dc5a01 (patch) | |
| tree | 05b1187184c4a7719effe91c6022fd6671149344 /src/game.c | |
| parent | 08c502d813b11b1f9dd7b7143a0987454c76ea32 (diff) | |
| download | FindThings-bdeb4f943fc351daeec22b4ef71d551342dc5a01.tar.gz FindThings-bdeb4f943fc351daeec22b4ef71d551342dc5a01.tar.bz2 FindThings-bdeb4f943fc351daeec22b4ef71d551342dc5a01.zip | |
Added backgrounds
Diffstat (limited to 'src/game.c')
| -rw-r--r-- | src/game.c | 29 |
1 files changed, 27 insertions, 2 deletions
@@ -98,6 +98,20 @@ void updateMainMenuScene(Game* game) ClearBackground(BLACK); } +void drawGameTexturedBackground(Texture texture) +{ + int screenWidth = GetRenderWidth(); + int screenHeight = GetRenderHeight(); + + for (int y = 0; y < screenHeight; y += texture.height) + { + for (int x = 0; x < screenWidth; x += texture.width) + { + DrawTexture(texture, x, y, WHITE); + } + } +} + void drawGameScreen(Game* game) { Texture texture = game->screen.render.texture; @@ -202,7 +216,7 @@ void updateGameScene(Game* game) } BeginTextureMode(game->screen.render); - ClearBackground(BLACK); + ClearBackground(PINK); BeginMode3D(game->player.camera); // Render skybox. @@ -218,7 +232,18 @@ void updateGameScene(Game* game) EndMode3D(); EndTextureMode(); - ClearBackground(BLACK); + // Draw background texture or color. + if (game->settings.useBackgroundTexture + && !FloatEquals(game->screen.destination.x, 0.0)) + { + AssetId backgroundTextureId = BACKGROUND1_TEXTURE + + game->settings.backgroundTextureNumber; + drawGameTexturedBackground(game->assets.textures[backgroundTextureId]); + } + else + { + ClearBackground(game->settings.backgroundColor); + } drawGameScreen(game); |
