tint the board if a winning state is reached
This commit is contained in:
@ -176,8 +176,8 @@ auto Renderer::DrawMassSprings(const MassSpringSystem &masssprings,
|
||||
}
|
||||
|
||||
auto Renderer::DrawKlotski(const State &state, int hov_x, int hov_y, int sel_x,
|
||||
int sel_y, int block_add_x, int block_add_y)
|
||||
-> void {
|
||||
int sel_y, int block_add_x, int block_add_y,
|
||||
const WinCondition win_condition) -> void {
|
||||
BeginTextureMode(klotski_target);
|
||||
ClearBackground(RAYWHITE);
|
||||
|
||||
@ -194,10 +194,10 @@ auto Renderer::DrawKlotski(const State &state, int hov_x, int hov_y, int sel_x,
|
||||
|
||||
DrawRectangle(0, 0, GetScreenWidth() / 2, GetScreenHeight() - MENU_HEIGHT,
|
||||
RAYWHITE);
|
||||
DrawRectangle(x_offset, y_offset,
|
||||
board_width - 2 * x_offset + 2 * BOARD_PADDING,
|
||||
board_height - 2 * y_offset + 2 * BOARD_PADDING,
|
||||
state.restricted ? DARKGRAY : LIGHTGRAY);
|
||||
DrawRectangle(
|
||||
x_offset, y_offset, board_width - 2 * x_offset + 2 * BOARD_PADDING,
|
||||
board_height - 2 * y_offset + 2 * BOARD_PADDING,
|
||||
win_condition(state) ? GREEN : (state.restricted ? DARKGRAY : LIGHTGRAY));
|
||||
for (int x = 0; x < state.width; ++x) {
|
||||
for (int y = 0; y < state.height; ++y) {
|
||||
DrawRectangle(x_offset + BOARD_PADDING + x * BLOCK_PADDING * 2 +
|
||||
|
||||
Reference in New Issue
Block a user