Track src modules; stop ignoring .odin files
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
33d55357cf
commit
964d9987be
9 files changed
+597
-17
No files matched your search
@@ -0,0 +1,113 @@
|
||||
package screens
|
||||
|
||||
import raylib "vendor:raylib"
|
||||
import themes "../themes"
|
||||
import assets "../assets"
|
||||
|
||||
draw_button :: proc(x, y, w, h: i32, text: cstring, base_color, hover_color: raylib.Color, mouse_x, mouse_y: i32) -> bool {
|
||||
is_hovered := mouse_x >= x && mouse_x <= x + w && mouse_y >= y && mouse_y <= y + h
|
||||
color := base_color
|
||||
if is_hovered {
|
||||
color = hover_color
|
||||
}
|
||||
raylib.DrawRectangle(x, y, w, h, color)
|
||||
raylib.DrawRectangleLines(x, y, w, h, themes.BLACK)
|
||||
font := assets.get_font()
|
||||
text_w := raylib.MeasureText(text, themes.BUTTON_FONT_SIZE)
|
||||
text_x := x + (w - text_w) / 2
|
||||
text_y := y + (h - themes.BUTTON_FONT_SIZE) / 2
|
||||
raylib.DrawTextEx(font, text, raylib.Vector2{f32(text_x), f32(text_y)}, f32(themes.BUTTON_FONT_SIZE), 0, themes.WHITE)
|
||||
return is_hovered && raylib.IsMouseButtonPressed(raylib.MouseButton.LEFT)
|
||||
}
|
||||
|
||||
draw_title :: proc(text: cstring, y: i32, color: raylib.Color) {
|
||||
font := assets.get_font()
|
||||
text_w := raylib.MeasureText(text, themes.TITLE_FONT_SIZE)
|
||||
x := (themes.SCREEN_WIDTH - text_w) / 2
|
||||
raylib.DrawTextEx(font, text, raylib.Vector2{f32(x + 4), f32(y + 4)}, f32(themes.TITLE_FONT_SIZE), 0, themes.BLACK)
|
||||
raylib.DrawTextEx(font, text, raylib.Vector2{f32(x), f32(y)}, f32(themes.TITLE_FONT_SIZE), 0, color)
|
||||
}
|
||||
|
||||
draw_centered_text :: proc(text: cstring, y: i32, font_size: i32, color: raylib.Color) {
|
||||
font := assets.get_font()
|
||||
text_w := raylib.MeasureText(text, font_size)
|
||||
x := (themes.SCREEN_WIDTH - text_w) / 2
|
||||
raylib.DrawTextEx(font, text, raylib.Vector2{f32(x + 4), f32(y + 4)}, f32(font_size), 0, themes.BLACK)
|
||||
raylib.DrawTextEx(font, text, raylib.Vector2{f32(x), f32(y)}, f32(font_size), 0, color)
|
||||
}
|
||||
|
||||
draw_main_menu :: proc(mouse_x, mouse_y: i32) -> i32 {
|
||||
raylib.ClearBackground(themes.WHITE)
|
||||
|
||||
draw_title("HanjaKanaMun", 100, themes.JAPAN_PRIMARY)
|
||||
draw_centered_text("Learn Japanese, Korean, and Thai", 180, themes.SUBTITLE_FONT_SIZE, themes.DARK_GRAY)
|
||||
|
||||
button_w := themes.BUTTON_WIDTH
|
||||
button_h := themes.BUTTON_HEIGHT
|
||||
button_space: i32 = 40
|
||||
total_w := button_w * 3 + button_space * 2
|
||||
start_x := (themes.SCREEN_WIDTH - total_w) / 2
|
||||
start_y := themes.SCREEN_HEIGHT / 2 + 100
|
||||
|
||||
if draw_button(start_x, start_y, button_w, button_h, "Japanese", themes.JAPAN_PRIMARY, themes.JAPAN_ACCENT, mouse_x, mouse_y) {
|
||||
return themes.JAPANESE_SCREEN
|
||||
}
|
||||
|
||||
if draw_button(start_x + button_w + button_space, start_y, button_w, button_h, "Korean", themes.KOREA_PRIMARY, themes.KOREA_ACCENT, mouse_x, mouse_y) {
|
||||
return themes.KOREAN_SCREEN
|
||||
}
|
||||
|
||||
if draw_button(start_x + i32(button_w) + i32(button_space) + i32(button_w) + i32(button_space), start_y, button_w, button_h, "Thai", themes.THAI_PRIMARY, themes.THAI_ACCENT, mouse_x, mouse_y) {
|
||||
return themes.THAI_SCREEN
|
||||
}
|
||||
|
||||
return themes.MAIN_MENU
|
||||
}
|
||||
|
||||
draw_japanese_screen :: proc(mouse_x, mouse_y: i32) -> i32 {
|
||||
raylib.ClearBackground(themes.WHITE)
|
||||
|
||||
draw_title("Japanese", 100, themes.JAPAN_PRIMARY)
|
||||
draw_centered_text("Select a game to play", 180, themes.SUBTITLE_FONT_SIZE, themes.DARK_GRAY)
|
||||
|
||||
button_w := themes.BUTTON_WIDTH
|
||||
button_h := themes.BUTTON_HEIGHT
|
||||
button_space := 40
|
||||
start_y := themes.SCREEN_HEIGHT / 2
|
||||
start_x := (themes.SCREEN_WIDTH - button_w) / 2
|
||||
|
||||
if draw_button(start_x, start_y, button_w, button_h, "Memory Game", themes.JAPAN_PRIMARY, themes.JAPAN_ACCENT, mouse_x, mouse_y) {
|
||||
return themes.JAPANESE_MEMORY
|
||||
}
|
||||
|
||||
back_y := i32(start_y) + i32(button_h) + i32(button_space)
|
||||
if draw_button(start_x, back_y, button_w, button_h, "Back", themes.JAPAN_PRIMARY, themes.JAPAN_ACCENT, mouse_x, mouse_y) {
|
||||
return themes.MAIN_MENU
|
||||
}
|
||||
|
||||
return themes.JAPANESE_SCREEN
|
||||
}
|
||||
|
||||
draw_korean_screen :: proc(mouse_x, mouse_y: i32) -> i32 {
|
||||
raylib.ClearBackground(themes.WHITE)
|
||||
draw_title("Korean", 100, themes.KOREA_PRIMARY)
|
||||
draw_centered_text("Coming Soon", 180, themes.SUBTITLE_FONT_SIZE, themes.DARK_GRAY)
|
||||
|
||||
if draw_button((themes.SCREEN_WIDTH - themes.BUTTON_WIDTH) / 2, themes.SCREEN_HEIGHT / 2, themes.BUTTON_WIDTH, themes.BUTTON_HEIGHT, "Back", themes.KOREA_PRIMARY, themes.KOREA_ACCENT, mouse_x, mouse_y) {
|
||||
return themes.MAIN_MENU
|
||||
}
|
||||
|
||||
return themes.KOREAN_SCREEN
|
||||
}
|
||||
|
||||
draw_thai_screen :: proc(mouse_x, mouse_y: i32) -> i32 {
|
||||
raylib.ClearBackground(themes.WHITE)
|
||||
draw_title("Thai", 100, themes.THAI_PRIMARY)
|
||||
draw_centered_text("Coming Soon", 180, themes.SUBTITLE_FONT_SIZE, themes.DARK_GRAY)
|
||||
|
||||
if draw_button((themes.SCREEN_WIDTH - themes.BUTTON_WIDTH) / 2, themes.SCREEN_HEIGHT / 2, themes.BUTTON_WIDTH, themes.BUTTON_HEIGHT, "Back", themes.THAI_PRIMARY, themes.THAI_ACCENT, mouse_x, mouse_y) {
|
||||
return themes.MAIN_MENU
|
||||
}
|
||||
|
||||
return themes.THAI_SCREEN
|
||||
}
|
||||
Reference in new issue
Block a user