vt100 simple mode added

This commit is contained in:
Tiehuis 2014-12-06 12:02:12 +13:00
parent 01af91121b
commit 569e11710f
2 changed files with 15 additions and 11 deletions

View File

@ -83,13 +83,14 @@ void merge(struct gamestate *g, direction d, void (*callback)(struct gamestate *
if (g->grid[x][y] && (g->grid[x][y] == g->grid[x+xoff][y+yoff])) {\
g->grid[x][y] += g->grid[x+xoff][y+yoff];\
g->grid[x+xoff][y+yoff] = 0;\
g->score_last = g->grid[x][y];\
g->score_last += g->grid[x][y];\
g->score += g->grid[x][y];\
g->moved = 1;\
}\
} while (0)
int x, y;
g->score_last = 0;
if (d == dir_left) {
for (x = 0; x < g->opts->grid_width - 1; ++x) {

View File

@ -70,9 +70,7 @@ int get_keypress(void)
return getch();
}
#elif VT100_COMPATIBLE
#else
#else /* vt100 and standard shared functions */
struct termios sattr;
void drawstate_clear()
{
@ -90,8 +88,19 @@ void drawstate_init(void)
tcsetattr(STDOUT_FILENO, TCSANOW, &tattr);
}
int get_keypress(void)
{
return fgetc(stdin);
}
void draw_screen(struct gamestate *g)
{
/* Clear the screen each draw if we are able to */
#ifdef VT100_COMPATIBLE
printf("\033[2J\033[H");
#endif
printf("HISCORE: %ld |", g->score_high);
printf("| SCORE: %ld ", g->score);
if (g->score_last) printf("(+%ld)", g->score_last);
@ -114,13 +123,7 @@ void draw_screen(struct gamestate *g)
ITER(g->opts->grid_width, printf("------"));
printf("-\n\n");
}
int get_keypress(void)
{
return fgetc(stdin);
}
#endif
#endif /* CURSES */
void ddraw(struct gamestate *g)
{