aboutsummaryrefslogtreecommitdiff
path: root/source/render.c
diff options
context:
space:
mode:
Diffstat (limited to 'source/render.c')
-rw-r--r--source/render.c20
1 files changed, 18 insertions, 2 deletions
diff --git a/source/render.c b/source/render.c
index 5af04f8..5f5fb25 100644
--- a/source/render.c
+++ b/source/render.c
@@ -3,18 +3,25 @@
static void RenderTiles(game_t * game);
static void RenderPlayers(game_t * game);
static void RenderBombs(game_t * game);
+static void RenderBottomText(game_t * game);
void Render(game_t * game, f64 interpolation) {
(void)game;
(void)interpolation;
BeginDrawing();
+
+#ifndef NDEBUG
ClearBackground(BLACK);
+#else
+ ClearBackground(COLOR_TO_RAYLIB(game->tiles.color));
+#endif
BeginMode2D(game->camera);
RenderTiles(game);
RenderBombs(game);
RenderPlayers(game);
EndMode2D();
+ RenderBottomText(game);
/* --- */
rlDrawRenderBatchActive();
SwapScreenBuffer();
@@ -23,9 +30,11 @@ void Render(game_t * game, f64 interpolation) {
void RenderTiles(game_t * game) {
for (int i = 0; i < game->config.map_x; ++i) {
for (int j = 0; j < game->config.map_y; ++j) {
+ #ifndef NDEBUG
if ((game->tiles.state[i][j]._ | 1) & PASSIBLE || game->tiles.state[i][j]._ == IMPASSIBLE_NOTHING) {
DrawRectangleRec((Rectangle) {i*game->config.spritesheet_scale, j*game->config.spritesheet_scale, game->config.spritesheet_scale, game->config.spritesheet_scale}, COLOR_TO_RAYLIB(game->tiles.color));
}
+ #endif
if (game->tiles.state[i][j]._ < 2) {
DrawTextureRec(
@@ -43,8 +52,6 @@ void RenderTiles(game_t * game) {
(Vector2) {i*game->config.spritesheet_scale, j*game->config.spritesheet_scale},
WHITE);
}
-
-
}
}
}
@@ -74,3 +81,12 @@ void RenderBombs(game_t * game) {
}
}
}
+
+static void RenderBottomText(game_t * game) {
+ BeginScissorMode(0, game->config.resolution_y - FONT_SIZE, game->config.resolution_x, FONT_SIZE);
+ ClearBackground(BLACK);
+ char center_string[128];
+ snprintf(center_string, 128, "%02d:%02d", game->time_limit / game->config.ups / 60, game->time_limit / game->config.ups % 60);
+ DrawText(center_string, game->config.resolution_x / 2 - MeasureText(center_string, FONT_SIZE) / 2, game->config.resolution_y - FONT_SIZE, FONT_SIZE, WHITE);
+ EndScissorMode();
+}