diff options
| author | 2019-03-13 18:39:49 -0400 | |
|---|---|---|
| committer | 2019-03-13 18:39:49 -0400 | |
| commit | 27a9537652d975477f664c266f8c3b7a56a25529 (patch) | |
| tree | b1b83bd857dbad7a86f25228c1b1bbde4df5ff72 /frontend | |
| parent | 21c18d41ed91742b07e5724c884b2ce62fe0284d (diff) | |
| download | cetris-27a9537652d975477f664c266f8c3b7a56a25529.tar.gz cetris-27a9537652d975477f664c266f8c3b7a56a25529.tar.bz2 cetris-27a9537652d975477f664c266f8c3b7a56a25529.zip | |
more restruture
Diffstat (limited to 'frontend')
| -rw-r--r-- | frontend/ncurses/ncurses_ui.c | 20 | ||||
| -rw-r--r-- | frontend/sdl/.border.jpeg-autosave.kra | bin | 71027 -> 0 bytes | |||
| -rw-r--r-- | frontend/sdl/sdl_ui.c | 10 |
3 files changed, 16 insertions, 14 deletions
diff --git a/frontend/ncurses/ncurses_ui.c b/frontend/ncurses/ncurses_ui.c index 7a92c0f..98f2b4b 100644 --- a/frontend/ncurses/ncurses_ui.c +++ b/frontend/ncurses/ncurses_ui.c @@ -35,17 +35,17 @@ " \\--------------------/"
#else
#define BLOCK "[]"
-#define PLAY_FIELD_STR " ┏━━━━━━━━━━━━━━━━━━━━┓ ┏━━━━━━━━━━━━━━━┓ \n"\
+#define PLAY_FIELD_STR " ┏━━━━━━━━━━━┓ ┏━━━━━━━━━\n"\
" ┃ ┃ ┃ ┃ \n"\
- " ┃ ┃ ┗━━━━━━━━━━━━━━━┛ \n"\
+ " ┃ ┃ ━━━━━━━━━┛ \n"\
" ┃ ┃ \n"\
" ┃ ┃ \n"\
- " ┃ ┃ ┏━━━━━━━━━━━┓ \n"\
+ " ┃ ┃ ┏━━━━━━┓ \n"\
" ┃ ┃ ┃ ┃ \n"\
" ┃ ┃ ┃ ┃ \n"\
" ┃ ┃ ┃ ┃ \n"\
" ┃ ┃ ┃ ┃ \n"\
- " ┃ ┃ ┗━━━━━━━━━━━┛ \n"\
+ " ┃ ┃ ┗━━━━━━┛ \n"\
" ┃ ┃ \n"\
" ┃ ┃ \n"\
" ┃ ┃ \n"\
@@ -56,7 +56,7 @@ " ┃ ┃ \n"\
" ┃ ┃ \n"\
" ┃ ┃ \n"\
- " ┗━━━━━━━━━━━━━━━━━━━━┛ "
+ " ┗━━━━━━━━━━━┛ "
#endif
#define X_OFFSET 8
@@ -86,16 +86,16 @@ void curses_init() { void draw_board() {
mvaddstr(0, 0, PLAY_FIELD_STR);
- for (int x = 0; x < BOARD_X; x++) {
- for (int y = BOARD_VISABLE; y < BOARD_Y; y++) {
+ for (int x = 0; x < CETRIS_BOARD_X; x++) {
+ for (int y = CETRIS_BOARD_VISABLE; y < CETRIS_BOARD_Y; y++) {
if (game.board[x][y].occupied) {
attron(COLOR_PAIR(game.board[x][y].c));
if (game.board[x][y].remove_tick > 0) {
if (game.tick % 2 == 0) {
- mvaddstr((y - BOARD_VISABLE) + 1, x * 2 + X_OFFSET, BLOCK);
+ mvaddstr((y - CETRIS_BOARD_VISABLE) + 1, x * 2 + X_OFFSET, BLOCK);
}
} else {
- mvaddstr((y - BOARD_VISABLE) + 1, x * 2 + X_OFFSET, BLOCK);
+ mvaddstr((y - CETRIS_BOARD_VISABLE) + 1, x * 2 + X_OFFSET, BLOCK);
}
attroff(COLOR_PAIR(game.board[x][y].c));
}
@@ -161,6 +161,8 @@ int main(void) { init_game(&game);
}
break;
+ default:
+ clear_held_key(&game.input);
}
update_game_tick(&game);
erase();
diff --git a/frontend/sdl/.border.jpeg-autosave.kra b/frontend/sdl/.border.jpeg-autosave.kra Binary files differdeleted file mode 100644 index 69f596a..0000000 --- a/frontend/sdl/.border.jpeg-autosave.kra +++ /dev/null diff --git a/frontend/sdl/sdl_ui.c b/frontend/sdl/sdl_ui.c index 8eaecab..c5c9917 100644 --- a/frontend/sdl/sdl_ui.c +++ b/frontend/sdl/sdl_ui.c @@ -141,11 +141,11 @@ void draw_stuff() { free(lines); SDL_SetRenderDrawColor(render, 255, 255, 255, 124); - for (int x = 0; x < BOARD_X + 1; x++) { + for (int x = 0; x < CETRIS_BOARD_X + 1; x++) { int rx = BOARD_OFFSET_X + 1 + (x * 25); SDL_RenderDrawLine(render, rx, BOARD_OFFSET_Y + 1, rx, BOARD_OFFSET_Y + 500); } - for (int y = 0; y < BOARD_Y - BOARD_VISABLE + 1; y++) { + for (int y = 0; y < CETRIS_BOARD_Y - CETRIS_BOARD_VISABLE + 1; y++) { int ry = BOARD_OFFSET_Y + (y * 25); SDL_RenderDrawLine(render, BOARD_OFFSET_X + 1, ry, BOARD_OFFSET_X + 250, ry); } @@ -153,13 +153,13 @@ void draw_stuff() { sdl_color c; SDL_Rect r = {0, 0, 25, 25}; - for (int x = 0; x < BOARD_X; x++) { - for (int y = BOARD_VISABLE; y < BOARD_Y; y++) { + for (int x = 0; x < CETRIS_BOARD_X; x++) { + for (int y = CETRIS_BOARD_VISABLE; y < CETRIS_BOARD_Y; y++) { if (g.board[x][y].occupied) { c = colors[g.board[x][y].c]; SDL_SetTextureColorMod(block, c.r, c.g, c.b); r.x = BOARD_OFFSET_X + x * 25; - r.y = BOARD_OFFSET_Y + (y - BOARD_VISABLE) * 25; + r.y = BOARD_OFFSET_Y + (y - CETRIS_BOARD_VISABLE) * 25; SDL_RenderCopy(render, block, NULL, &r); } } |