@@ -132,10 +132,14 @@ pub struct Board {
132
132
pub is_game_against_bot : bool ,
133
133
// the display mode
134
134
pub display_mode : DisplayMode ,
135
+ // coordinates of the interactable part of the screen (either normal chess board or promotion screen)
135
136
pub top_x : u16 ,
136
137
pub top_y : u16 ,
138
+ // dimension of a selectable cell (either 1 of the 64 cells, or 1 of the 4 promotion options)
137
139
pub width : u16 ,
138
140
pub height : u16 ,
141
+ // last move was with a mouse
142
+ pub mouse_used : bool ,
139
143
// if the bot is starting, meaning the player is black
140
144
pub is_bot_starting : bool ,
141
145
// The white piece that got taken
@@ -218,6 +222,7 @@ impl Default for Board {
218
222
is_bot_starting : false ,
219
223
white_taken_pieces : vec ! [ ] ,
220
224
black_taken_pieces : vec ! [ ] ,
225
+ mouse_used : false ,
221
226
}
222
227
}
223
228
}
@@ -248,6 +253,7 @@ impl Board {
248
253
is_bot_starting : false ,
249
254
white_taken_pieces : vec ! [ ] ,
250
255
black_taken_pieces : vec ! [ ] ,
256
+ mouse_used : false ,
251
257
}
252
258
}
253
259
@@ -1006,7 +1012,7 @@ impl Board {
1006
1012
// - last move cell: green
1007
1013
// - default cell: white or black
1008
1014
// Draw the cell blue if this is the current cursor cell
1009
- if i == self . cursor_coordinates . row && j == self . cursor_coordinates . col {
1015
+ if i == self . cursor_coordinates . row && j == self . cursor_coordinates . col && self . mouse_used == false {
1010
1016
Board :: render_cell ( frame, square, Color :: LightBlue , None ) ;
1011
1017
}
1012
1018
// Draw the cell magenta if the king is getting checked
0 commit comments