diff options
Diffstat (limited to 'src/sdl')
-rw-r--r-- | src/sdl/draw.c | 114 |
1 files changed, 0 insertions, 114 deletions
diff --git a/src/sdl/draw.c b/src/sdl/draw.c index 630ecd1..09da95e 100644 --- a/src/sdl/draw.c +++ b/src/sdl/draw.c @@ -5,8 +5,6 @@ #include "draw.h" #include "sprites.h" -#define DRAW_SPRITES - static size_t get_cell_size( const draw_ctx_t * const draw_ctx @@ -49,7 +47,6 @@ on_size( draw_ctx->render_ofs_y = (renderer_y - level_size.y * cell_size) / 2; } -#ifdef DRAW_SPRITES static void draw_cell( draw_ctx_t * const draw_ctx, @@ -168,117 +165,6 @@ DRAW_CBS = { .on_home = draw_sprites_on_home, .on_box = draw_sprites_on_box, }; -#else /* !DRAW_SPRITES */ -static void -fill_cell( - draw_ctx_t * const draw_ctx, - const sok_pos_t pos -) { - const SDL_Rect rect = get_cell_rect(draw_ctx, pos); - - if (SDL_RenderFillRect(draw_ctx->renderer, &rect)) { - die("SDL_RenderFillRect(): %s", SDL_GetError()); - } -} - -static bool -draw_colors_on_size( - const sok_ctx_t * const ctx, - const sok_pos_t level_size, - void * const data -) { - on_size(ctx, level_size, data); - return true; -} - -static bool -draw_colors_on_walls_start( - const sok_ctx_t * const ctx, - void * const data -) { - draw_ctx_t * const draw_ctx = data; - set_color(draw_ctx->renderer, COLOR_WALL); - - return true; -} - -static bool -draw_colors_on_wall( - const sok_ctx_t * const ctx, - const sok_pos_t pos, - void * const data -) { - draw_ctx_t * const draw_ctx = data; - fill_cell(draw_ctx, pos); - return true; -} - -static bool -draw_colors_on_goals_start( - const sok_ctx_t * const ctx, - void * const data -) { - draw_ctx_t * const draw_ctx = data; - set_color(draw_ctx->renderer, COLOR_GOAL); - return true; -} - -static bool -draw_colors_on_goal( - const sok_ctx_t * const ctx, - const sok_pos_t pos, - const bool has_player, - const bool has_box, - void * const data -) { - draw_ctx_t * const draw_ctx = data; - - fill_cell(draw_ctx, pos); - - return true; -} - -static bool -draw_colors_on_home( - const sok_ctx_t * const ctx, - const sok_pos_t pos, - const bool has_goal, - void * const data -) { - draw_ctx_t * const draw_ctx = data; - - set_color(draw_ctx->renderer, has_goal ? COLOR_HOME_GOAL : COLOR_HOME); - fill_cell(draw_ctx, pos); - - return true; -} - -static bool -draw_colors_on_box( - const sok_ctx_t * const ctx, - const sok_pos_t pos, - const bool has_goal, - void * const data -) { - draw_ctx_t * const draw_ctx = data; - - set_color(draw_ctx->renderer, has_goal ? COLOR_BOX_GOAL : COLOR_BOX); - fill_cell(draw_ctx, pos); - - return true; -} - -static const sok_ctx_walk_cbs_t -DRAW_CBS = { - .on_size = draw_colors_on_size, - .on_walls_start = draw_colors_on_walls_start, - .on_wall = draw_colors_on_wall, - .on_goals_start = draw_colors_on_goals_start, - .on_goal = draw_colors_on_goal, - .on_home = draw_colors_on_home, - .on_box = draw_colors_on_box, -}; -#endif /* DRAW_SPRITES */ static const SDL_Color TEXT_COLORS[] = { |