Files
catch-phase/game.sex
2026-11-03 19:35:23 +03:00

38 lines
1.1 KiB
Scheme

(include raylib.h)
(pub import pages)
(import main)
(import utils)
(pub record game-state
((app-state (* app-state))))
(pub fn mk-game ((app-state (* app-state))) page
(var state _ (mem-alloc game-state))
(= (. state app-state) app-state)
(return (page/game state)))
(pub fn rm-game ((state (* game-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-game ((state (* game-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))
#(Color : 255 255 0 255)
#(Color : 255 0 255 255)
#(Color : 0 255 255 255))
(EndDrawing))
(pub fn process-input-game ((state (* game-state))) void
(if (IsMouseButtonReleased MOUSE-LEFT-BUTTON)
(.change-page (. state app-state) (sum-type page menu))))