Add keyboard play: arrows/WASD/hjkl focus, Enter/Space flips

Focus ring appears on the first key press and hides when the mouse moves.
Enter also triggers Play Again on the win panel.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
SansanandClaude Opus 5.5 committed 2026-10-01 21:34:00 +02:00
1 parent 8214fda8f6
commit 685182b25d
4 files changed
+74 -9

No files matched your search

+20
View File
@@ -270,3 +270,23 @@ card_pulse_counts_down :: proc(t: ^testing.T) {
card.update(&c, 1)
testing.expect_value(t, c.pulse_t, 0)
}
@(test)
keyboard_focus_stays_inside_grid :: proc(t: ^testing.T) {
memory.deal(.HIRAGANA, .NORMAL) // 4 rows x 6 columns
testing.expect_value(t, memory.focus, 0)
memory.move_focus(-1, -1) // already top-left
testing.expect_value(t, memory.focus, 0)
memory.move_focus(1, 0)
testing.expect_value(t, memory.focus, 1)
memory.move_focus(0, 1)
testing.expect_value(t, memory.focus, 7)
memory.move_focus(100, 100) // clamps to bottom-right
testing.expect_value(t, memory.focus, memory.card_count - 1)
memory.deal(.HIRAGANA, .HARD) // dealing resets focus
testing.expect_value(t, memory.focus, 0)
memory.move_focus(0, 3)
testing.expect_value(t, memory.focus, 24) // 4 rows x 8 columns
}