decrease special mass size + add hjkl movement bindings

This commit is contained in:
2026-02-22 01:49:54 +01:00
parent 35de23e865
commit 12a96cba66
4 changed files with 13 additions and 14 deletions

View File

@ -88,19 +88,19 @@ auto InputHandler::HandleMouse() -> void {
}
auto InputHandler::HandleKeys() -> void {
if (IsKeyPressed(KEY_W)) {
if (IsKeyPressed(KEY_W) || IsKeyPressed(KEY_K)) {
if (state.current_state.MoveBlockAt(sel_x, sel_y, Direction::NOR)) {
sel_y--;
}
} else if (IsKeyPressed(KEY_A)) {
} else if (IsKeyPressed(KEY_A) || IsKeyPressed(KEY_H)) {
if (state.current_state.MoveBlockAt(sel_x, sel_y, Direction::WES)) {
sel_x--;
}
} else if (IsKeyPressed(KEY_S)) {
} else if (IsKeyPressed(KEY_S) || IsKeyPressed(KEY_J)) {
if (state.current_state.MoveBlockAt(sel_x, sel_y, Direction::SOU)) {
sel_y++;
}
} else if (IsKeyPressed(KEY_D)) {
} else if (IsKeyPressed(KEY_D) || IsKeyPressed(KEY_L)) {
if (state.current_state.MoveBlockAt(sel_x, sel_y, Direction::EAS)) {
sel_x++;
}

View File

@ -109,7 +109,6 @@ auto main(int argc, char *argv[]) -> int {
renderer.DrawMassSprings(mass_springs, state.current_state,
state.winning_states);
// TODO: Don't render each frame
renderer.DrawKlotski(state.current_state, input.hov_x, input.hov_y,
input.sel_x, input.sel_y, input.block_add_x,
input.block_add_y, state.CurrentWinCondition());

View File

@ -216,16 +216,16 @@ auto Renderer::DrawMassSprings(const MassSpringSystem &mass_springs,
// Mark current state
const Mass &current_mass = mass_springs.GetMass(current_state);
DrawCube(current_mass.position, VERTEX_SIZE * 4, VERTEX_SIZE * 4,
VERTEX_SIZE * 4, RED);
DrawCube(current_mass.position, VERTEX_SIZE * 2, VERTEX_SIZE * 2,
VERTEX_SIZE * 2, RED);
// Mark winning states
if (mark_solutions || connect_solutions) {
for (const auto &state : winning_states) {
const Mass &winning_mass = mass_springs.GetMass(state);
if (mark_solutions) {
DrawCube(winning_mass.position, 4 * VERTEX_SIZE, 4 * VERTEX_SIZE,
4 * VERTEX_SIZE, BLUE);
DrawCube(winning_mass.position, 2 * VERTEX_SIZE, 2 * VERTEX_SIZE,
2 * VERTEX_SIZE, BLUE);
}
if (connect_solutions) {