fix: next shape misaligned

This commit is contained in:
2025-02-04 10:30:12 +01:00
parent bb8d9b47a2
commit b3808a46a0
2 changed files with 3 additions and 3 deletions

View File

@@ -87,10 +87,10 @@ void renderer_update(const RenderData* render_data) {
set_colour(renderer, COLOUR_WHITE);
SDL_RenderDrawRect(renderer, &(SDL_Rect){TET_PADDING, TET_PADDING, TET_WIDTH + 1, TET_HEIGHT + 1});
draw_shape(renderer, game_data->nxt[game_data->curr_idx + 1], COLUMNS, 2);
draw_shape(renderer, game_data->nxt[game_data->curr_idx + 1], COLUMNS + 1, 2); // draw the next shape
render_level(renderer, render_data->game_data);
draw_shape(renderer, game_data->nxt[game_data->curr_idx], game_data->sel_x, game_data->sel_y);
draw_shape(renderer, game_data->nxt[game_data->curr_idx], game_data->sel_x, game_data->sel_y); // draw the current shape
if (success < 0) {
warn("something went wrong whilst renderering! SDL Error: %s\n", SDL_GetError());

View File

@@ -9,7 +9,7 @@
#define TET_PADDING 10 // padding around the tetris playing field
#define TET_WIDTH (COLUMNS * PX_DENS - TET_PADDING) // tetris playing field width
#define TET_HEIGHT (TET_WIDTH / COLUMNS * ROWS) // tetris playing field height
#define SCREEN_WIDTH ((COLUMNS + 4) * PX_DENS) // window width
#define SCREEN_WIDTH ((COLUMNS + 6) * PX_DENS) // window width
#define SCREEN_HEIGHT ((COLUMNS + 1) * PX_DENS / COLUMNS * ROWS) // window height
#define BLOCK_WIDTH (TET_WIDTH / COLUMNS) // width of a block
#define BLOCK_HEIGHT (TET_HEIGHT / ROWS) // height of a block