add initial pages support
This commit is contained in:
37
menu.sex
Normal file
37
menu.sex
Normal 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))))
|
||||
Reference in New Issue
Block a user