src/game.c

changeset 54
eef745ba3774
parent 53
78b580bfde33
child 55
54ea19938d57
equal deleted inserted replaced
53:78b580bfde33 54:eef745ba3774
70 70
71 return 0; 71 return 0;
72 } 72 }
73 73
74 static void draw_board(GameState *gamestate, uint8_t perspective) { 74 static void draw_board(GameState *gamestate, uint8_t perspective) {
75 char fen[90];
76 compute_fen(fen, gamestate);
77 mvaddstr(0, 0, fen);
78
75 for (uint8_t y = 0 ; y < 8 ; y++) { 79 for (uint8_t y = 0 ; y < 8 ; y++) {
76 for (uint8_t x = 0 ; x < 8 ; x++) { 80 for (uint8_t x = 0 ; x < 8 ; x++) {
77 uint8_t col = gamestate->board[y][x] & COLOR_MASK; 81 uint8_t col = gamestate->board[y][x] & COLOR_MASK;
78 uint8_t piece = gamestate->board[y][x] & PIECE_MASK; 82 uint8_t piece = gamestate->board[y][x] & PIECE_MASK;
79 char piecec; 83 char piecec;
107 mvaddch(y, boardx-2, '1'+i); 111 mvaddch(y, boardx-2, '1'+i);
108 } 112 }
109 113
110 /* move log */ 114 /* move log */
111 // TODO: introduce window to avoid bugs with a long move log 115 // TODO: introduce window to avoid bugs with a long move log
112 uint8_t logy = 0; 116 uint8_t logy = 1;
113 const uint8_t logx = boardx + 30; 117 const uint8_t logx = boardx + 30;
114 int logi = 1; 118 int logi = 1;
115 MoveList *logelem = gamestate->movelist; 119 MoveList *logelem = gamestate->movelist;
116 120
117 while (logelem) { 121 while (logelem) {

mercurial