38 lines
1021 B
Scheme
38 lines
1021 B
Scheme
(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))))
|