diff options
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); |
