mvaddcb (y, x, lighterred);
break;
case '4':
- mvaddcb (y, x, lightergreen);
+ mvaddcb (y, x, yellow);
break;
}
}
char *filename = NULL;
int scale = 1;
-char *boardname = "12x12";
+char *boardname = "8x8";
char *help =
"<i> Move up cursor\n"
"<j> Move left cursor\n"
"<k> Move down cursor\n"
"<l> Move right cursor\n"
+ "<m> Show/Hide positions\n"
"<o> Hold/Release piece\n"
"<q> Quit\n"
"<s> Save file\n"
/* main loop */
int stop = 0;
+ int showpos = 0;
int id = 0;
int mode = 0;
while (!stop) {
+ /* board */
board_t *boardturn = copyboard (board);
- int ret = find (boardturn, id);
- boardwindow (boardturn, 0);
+ if (!find (boardturn, id)) {
+ id = id ? 0 : 1;
+ if (!find (boardturn, id)) {
+ mode = 1;
+ }
+ }
+ boardwindow ((showpos) ? boardturn : board, 0);
freeboard (boardturn);
- displaycursor (board, id, xcursor, ycursor);
+ /* cursor */
+ if (!mode) {
+ displaycursor (board, id, xcursor, ycursor);
+ }
+
+ /* message */
+
+ /* get key press */
int ch = getch ();
/* general controls */
case KEY_DELETE:
case 127:
case 'u':
- id = (id == 0) ? 1 : 0;
+ id = id ? 0 : 1;
break;
case KEY_UP:
case 'i':
xcursor++;
}
break;
+ case 'm':
+ showpos = showpos ? 0 : 1;
+ break;
case '\n':
case '\r':
case ' ':
case 'o':
if (putdisk (board, xcursor, ycursor, id)) {
- id = (id == 0) ? 1 : 0;
+ id = id ? 0 : 1;
}
break;
}