X-Git-Url: https://git.piment-noir.org/?p=Project_algorithmic_C.git;a=blobdiff_plain;f=lib%2Fui.c;h=ae14d1df861be54fe1d6160ecef48c86d660d3f2;hp=c75e3b01ca69f981a1544455fc6aaf51494968b3;hb=a8b5457691fcb565dd185e7a623dd53eca96127c;hpb=54f1c58cef6764fdd611eedc267e7491e777c09b diff --git a/lib/ui.c b/lib/ui.c index c75e3b0..ae14d1d 100644 --- a/lib/ui.c +++ b/lib/ui.c @@ -56,6 +56,12 @@ void print_board(int y, int x) { mvprintw(y+25, x, " -----+----+----+----+----+----+----+-----"); } +static void set_default_colors() { + + init_pair(1, COLOR_WHITE, COLOR_BLACK); + attron(COLOR_PAIR(1)); +} + static void print_o(int y, int x, unsigned int type) { if (type == black) { @@ -69,8 +75,7 @@ static void print_o(int y, int x, unsigned int type) { mvprintw(y, x, "/\\"); mvprintw(y+1, x, "\\/"); /* reset to default */ - init_pair(1, COLOR_WHITE, COLOR_BLACK); - attron(COLOR_PAIR(1)); + set_default_colors(); } /* will be used for pawn placement hints */ @@ -86,8 +91,7 @@ static void print_x(int y, int x, unsigned int type) { mvprintw(y, x, "\\/"); mvprintw(y+1, x,"/\\"); /* reset to default */ - init_pair(1, COLOR_WHITE, COLOR_BLACK); - attron(COLOR_PAIR(1)); + set_default_colors(); } /* y = 1: y -> 0 x = 1: 1 -> 1