Add Katakana, Korean and Thai games and difficulty levels
- decks package: Hiragana, Katakana, Hangul jamo and Thai consonants (Thai readings carry the letter's name word, since sounds repeat) - Per-script fonts: Jua for Hangul, Mali for Thai (both OFL) - Memory game works with any deck; Easy 3x4, Normal 4x6, Hard 4x8 - Language menus pick a deck and difficulty, with number/arrow key shortcuts - Tests cover every deck, difficulty, and font glyph coverage Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
4cfe73c9eb
commit
8214fda8f6
15 files changed
+1920
-229
No files matched your search
@@ -4,6 +4,7 @@ import raylib "vendor:raylib"
|
||||
import assets "src/assets"
|
||||
import audio "src/audio"
|
||||
import card "src/card"
|
||||
import decks "src/decks"
|
||||
import memory "src/memory"
|
||||
import screens "src/screens"
|
||||
import themes "src/themes"
|
||||
@@ -12,9 +13,9 @@ import ui "src/ui"
|
||||
// Where Escape takes you from each screen (nil = quit)
|
||||
parent_screen :: proc(screen: themes.Screen) -> Maybe(themes.Screen) {
|
||||
switch screen {
|
||||
case .MAIN_MENU: return nil
|
||||
case .JAPANESE_MEMORY: return .JAPANESE_MENU
|
||||
case .JAPANESE_MENU, .KOREAN_MENU, .THAI_MENU: return .MAIN_MENU
|
||||
case .MAIN_MENU: return nil
|
||||
case .LANGUAGE_MENU: return .MAIN_MENU
|
||||
case .MEMORY: return .LANGUAGE_MENU
|
||||
}
|
||||
return nil
|
||||
}
|
||||
@@ -40,6 +41,8 @@ main :: proc() {
|
||||
defer memory.unload()
|
||||
|
||||
screen := themes.Screen.MAIN_MENU
|
||||
language := decks.Language.JAPANESE
|
||||
difficulty := memory.Difficulty.NORMAL
|
||||
running := true
|
||||
for running && !raylib.WindowShouldClose() {
|
||||
dt := raylib.GetFrameTime()
|
||||
@@ -52,27 +55,37 @@ main :: proc() {
|
||||
}
|
||||
}
|
||||
|
||||
if screen == .JAPANESE_MEMORY {
|
||||
if screen == .MEMORY {
|
||||
memory.update(dt)
|
||||
}
|
||||
|
||||
raylib.BeginDrawing()
|
||||
ui.begin_frame()
|
||||
next := screen
|
||||
start_deck: Maybe(decks.Deck_Id)
|
||||
switch screen {
|
||||
case .MAIN_MENU: next = screens.main_menu()
|
||||
case .JAPANESE_MENU: next = screens.japanese_menu()
|
||||
case .JAPANESE_MEMORY: next = memory.draw()
|
||||
case .KOREAN_MENU: next = screens.korean_menu()
|
||||
case .THAI_MENU: next = screens.thai_menu()
|
||||
case .MAIN_MENU:
|
||||
if picked, ok := screens.main_menu().?; ok {
|
||||
language = picked
|
||||
next = .LANGUAGE_MENU
|
||||
}
|
||||
case .LANGUAGE_MENU:
|
||||
switch result in screens.language_menu(language, &difficulty) {
|
||||
case decks.Deck_Id:
|
||||
start_deck = result
|
||||
next = .MEMORY
|
||||
case themes.Screen:
|
||||
next = result
|
||||
}
|
||||
case .MEMORY:
|
||||
next = memory.draw()
|
||||
}
|
||||
ui.end_frame()
|
||||
raylib.EndDrawing()
|
||||
|
||||
// Start a fresh game when entering the memory screen (outside of drawing,
|
||||
// because building card faces renders into textures)
|
||||
if next == .JAPANESE_MEMORY && screen != .JAPANESE_MEMORY {
|
||||
memory.start(themes.JAPAN)
|
||||
// Building card faces renders into textures, so do it outside of drawing
|
||||
if deck, ok := start_deck.?; ok {
|
||||
memory.start(deck, difficulty)
|
||||
}
|
||||
screen = next
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user