このコミットが含まれているのは:
woosh 2023-11-15 09:54:04 +00:00
コミット 58d97e34b5
1個のファイルの変更18行の追加3行の削除

21
uttt.c
ファイルの表示

@ -238,9 +238,14 @@ void ut_drawBoards(void (*mvch)(void*, int, int, char), void *arg, const struct
'\0', false);
}
void ut_cursmvch(void *arg, int y, int x, char c)
void ut_cursmvchc(void *arg, int y, int x, char c)
{
if(has_colors())
{
color_set(c == 'X' ? 1 : c == 'O' ? 2 : 0, NULL);
}
mvaddch(curs_line + y, x, c);
if(has_colors()) {color_set(0, NULL);}
}
void ut_tmvch(void *arg, int y, int x, char c)
{
@ -255,10 +260,14 @@ void ut_bmvch(void *arg, int y, int x, char c)
void ut_cursdraw(const struct ut_state *state)
{
ut_cursprintf("Turn: %c Play board: %d\n", (int)state->player, state->playBoard);
ut_drawTiles(ut_cursmvch, NULL, state, false);
ut_drawTiles(ut_cursmvchc, NULL, state, false);
curs_line += DTILES_Y;
//ut_drawBoards(ut_cursmvch, NULL, state);
//ut_drawBoards(ut_cursmvchc, NULL, state);
if(has_colors())
{
// TODO set bold on last played character
}
}
void ut_sockdraw(const struct ut_state *state, int fd)
{
@ -663,6 +672,12 @@ void begin(void)
nonl(); // \r instead of \r\n
cbreak();
noecho();
if (has_colors())
{
start_color();
init_pair(1, COLOR_RED, COLOR_BLACK);
init_pair(2, COLOR_BLUE, COLOR_BLACK);
}
mousemask(BUTTON1_CLICKED, NULL);
}