add initial pages support

This commit is contained in:
2026-11-03 19:35:23 +03:00
parent f6efe2956e
commit 6f2367455a
6 changed files with 128 additions and 15 deletions

37
menu.sex Normal file
View File

@@ -0,0 +1,37 @@
(include raylib.h)
(pub import pages)
(import main)
(import utils)
(pub record menu-state
((app-state (* app-state))))
(pub fn mk-menu ((app-state (* app-state))) page
(var state _ (mem-alloc menu-state))
(= (. state app-state) app-state)
(return (page/menu state)))
(pub fn rm-menu ((state (* menu-state))) void
(free state)
(return))
#-emscripten (define WIN-WIDTH 1440)
#-emscripten (define WIN-HEIGHT 900)
#+emscripten (define WIN-WIDTH 960)
#+emscripten (define WIN-HEIGHT 600)
(pub fn render-menu ((state (* menu-state))) void
(BeginDrawing)
(ClearBackground BLACK)
(DrawTriangleGradient
#(Vector2 : (- (/ WIN-WIDTH 2) 100) (+ (/ WIN-HEIGHT 2) 100.0f))
#(Vector2 : (+ (/ WIN-WIDTH 2) 100) (+ (/ WIN-HEIGHT 2) 100.0f))
#(Vector2 : (/ WIN-WIDTH 2) (- (/ WIN-HEIGHT 2) 100))
RED
GREEN
BLUE)
(EndDrawing))
(pub fn process-input-menu ((state (* menu-state))) void
(if (IsMouseButtonReleased MOUSE-LEFT-BUTTON)
(.change-page (. state app-state) (sum-type page game))))