diff options
| author | 2019-10-31 01:54:57 -0400 | |
|---|---|---|
| committer | 2019-10-31 01:54:57 -0400 | |
| commit | 6830c84690b7d6526b1986ebc47ce15312fefdec (patch) | |
| tree | ec695969765dce3cb02b64aa549da18d3f7b5aad | |
| parent | 32b3b3f61b2202451e809a71e0c921c07692c6db (diff) | |
| download | cetris-6830c84690b7d6526b1986ebc47ce15312fefdec.tar.gz cetris-6830c84690b7d6526b1986ebc47ce15312fefdec.tar.bz2 cetris-6830c84690b7d6526b1986ebc47ce15312fefdec.zip | |
fixup some ui issues
| -rw-r--r-- | frontends/sdl/cetris_sdl.c | 35 | ||||
| m--------- | ini | 0 | ||||
| -rw-r--r-- | lib/cetris.c | 6 | ||||
| -rw-r--r-- | lib/cetris.h | 6 |
4 files changed, 15 insertions, 32 deletions
diff --git a/frontends/sdl/cetris_sdl.c b/frontends/sdl/cetris_sdl.c index 0e4bcc1..35165c7 100644 --- a/frontends/sdl/cetris_sdl.c +++ b/frontends/sdl/cetris_sdl.c @@ -119,28 +119,16 @@ void load_skin(cetris_ui *ui) { format_str(name, 120, "%s/playboard.png", dir_name); ui->skin.game_background = load_png(ui, name); if (ui->skin.game_background != NULL) { - SDL_SetTextureAlphaMod(ui->skin.game_background, 100); + SDL_SetTextureAlphaMod(ui->skin.game_background, 120); SDL_SetTextureBlendMode(ui->skin.game_background, SDL_BLENDMODE_BLEND); } - format_str(name, 120, "%s/overlay_top.png", dir_name); - ui->skin.overlay_top = load_png(ui, name); - if (ui->skin.overlay_top != NULL) { - SDL_SetTextureBlendMode(ui->skin.overlay_top, SDL_BLENDMODE_BLEND); - } - format_str(name, 120, "%s/overlay_middle.png", dir_name); ui->skin.overlay_middle = load_png(ui, name); if (ui->skin.overlay_middle != NULL) { SDL_SetTextureBlendMode(ui->skin.overlay_middle, SDL_BLENDMODE_BLEND); } - format_str(name, 120, "%s/overlay_bottom.png", dir_name); - ui->skin.overlay_bottom = load_png(ui, name); - if (ui->skin.overlay_bottom != NULL) { - SDL_SetTextureBlendMode(ui->skin.overlay_bottom, SDL_BLENDMODE_BLEND); - } - format_str(name, 120, "%s/border.png", dir_name); ui->skin.border = load_png(ui, name); if (ui->skin.border != NULL) { @@ -216,14 +204,14 @@ void draw_image(cetris_ui *ui, SDL_Texture *i, int x, int y, int width, int heig void draw_block(cetris_ui *ui, int x, int y, int width, int height, int mino, int alpha, SDL_Color off) { if (ui->skin.blocks) { - SDL_Rect b = {x + 1, y + 1, width, height}; + SDL_Rect b = {x, y, width, height}; SDL_Rect block = {(mino + 2) * 32, 0, 32, 32}; SDL_SetTextureAlphaMod(ui->skin.blocks, alpha); SDL_RenderCopy(ui->render, ui->skin.blocks, &block, &b); } else { SDL_Rect b = {x + 1, y + 1, width - 1, height - 1}; SDL_Color c = mino_colors[mino]; - SDL_SetRenderDrawColor(ui->render, c.r, c.g, c.b, alpha); + //SDL_SetRenderDrawColor(ui->render, c.r, c.g, c.b, alpha); SDL_RenderFillRect(ui->render, &b); SDL_RenderDrawRect(ui->render, &b); SDL_SetRenderDrawColor(ui->render, off.r, off.g, off.b, off.a); @@ -262,20 +250,15 @@ void draw_board(cetris_ui *ui, SDL_Texture *m, game_board_t* board, int x, int y int block_width = w / board->game.config.board_x; int block_height = h / board->game.config.board_visible; - if (ui->skin.overlay_top && - ui->skin.overlay_middle && ui->skin.overlay_bottom) { + if (ui->skin.overlay_middle) { for (int j = 0; j < board->game.config.board_visible + 1; j++) { if (j == 0) { - SDL_Rect overlay = {0, 0, block_width * 10, block_height}; - SDL_Rect cutoff = {0, block_height - y_offset, block_width * 10, block_height}; - SDL_RenderCopy(ui->render, ui->skin.overlay_top, &cutoff, &overlay); + SDL_Rect overlay = {0, y_offset - block_height, (block_width * 10), block_height}; + //SDL_Rect cutoff = {0, block_height - y_offset, (block_width * 10), block_height}; + SDL_RenderCopy(ui->render, ui->skin.overlay_middle, NULL, &overlay); } else { - SDL_Rect overlay = {0, y_offset + ((j - 1) * block_height) + 2, block_width * 10, block_height}; - if (j == board->game.config.board_visible) { - SDL_RenderCopy(ui->render, ui->skin.overlay_bottom, NULL, &overlay); - } else { - SDL_RenderCopy(ui->render, ui->skin.overlay_middle, NULL, &overlay); - } + SDL_Rect overlay = {0, y_offset + ((j - 1) * block_height), (block_width * 10), block_height}; + SDL_RenderCopy(ui->render, ui->skin.overlay_middle, NULL, &overlay); } } } else { diff --git a/ini b/ini -Subproject 9b15f721fd53b1beb8364f8763e2207963ac4fd +Subproject 3401f2ed3153c6093c2f434e205cf6e7775a02d diff --git a/lib/cetris.c b/lib/cetris.c index 38fd07b..82009b2 100644 --- a/lib/cetris.c +++ b/lib/cetris.c @@ -14,11 +14,11 @@ /* DEFAULT TETRIMINO */ CETRIS_EXPORT const piece_matrix default_matrices[7] = { - { 0b0000, 0b0110, 0b0110, 0b0000}, - { 0b0000, 0b1111, 0b0000, 0b0000}, - { 0b0000, 0b0110, 0b1100, 0b0000}, { 0b0000, 0b1100, 0b0110, 0b0000}, { 0b0000, 0b0010, 0b1110, 0b0000}, + { 0b0000, 0b0110, 0b0110, 0b0000}, + { 0b0000, 0b0110, 0b1100, 0b0000}, + { 0b0000, 0b1111, 0b0000, 0b0000}, { 0b0000, 0b1000, 0b1110, 0b0000}, { 0b0000, 0b0100, 0b1110, 0b0000}}; diff --git a/lib/cetris.h b/lib/cetris.h index 8841df2..0823444 100644 --- a/lib/cetris.h +++ b/lib/cetris.h @@ -30,11 +30,11 @@ typedef struct { typedef uint8_t piece_matrix[4]; enum { - MINO_O, - MINO_I, - MINO_S, MINO_Z, MINO_L, + MINO_O, + MINO_S, + MINO_I, MINO_J, MINO_T }; |