lispjam-autumn-2024/mode-intro.fnl

65 lines
2.4 KiB
Fennel

(var (screen-width screen-height) (love.window.getMode))
(var (mx my) (values (/ screen-width 2) (/ screen-height 2)))
(love.mouse.setGrabbed false)
(love.mouse.setRelativeMode false)
(love.graphics.setNewFont 30)
(var footer-font (love.graphics.newFont 19))
(local (major minor revision) (love.getVersion))
(fn helmet-hud []
(love.graphics.setColor 0 1 0 0.25)
(love.graphics.line 0 0
(+ (/ screen-width 6) 0) 35
(+ (/ screen-width 3) 0) 30
(- screen-width (/ screen-width 3)) 30
(- screen-width (/ screen-width 6)) 35
screen-width 0))
(var menu-font (love.graphics.newFont 20))
(fn menu-button [x y t]
(love.graphics.polygon "line" x y
(+ x 100) y
(+ x 120) (+ y 20)
(+ x 100) (+ y 40)
x (+ y 40)
(- x 20) (+ y 20))
(love.graphics.printf t x (+ y 11) (+ x 100))
)
{
:draw
(fn draw []
(helmet-hud)
(menu-button (- (/ screen-width 2) 50) 100 (.. mx ", " my))
; (love.graphics.setNewFont 50)
; (love.graphics.setColor 0.75 0.75 0.75)
; (love.graphics.printf "L4-N-DER Training Simulator" 0
; (- (/ screen-height 2) 100) screen-width :center)
; (love.graphics.setNewFont 20)
; (love.graphics.setColor 0.55 0.55 0.05)
; (love.graphics.printf "OFFICIAL LANDER EYES ONLY" 0
; (- (/ screen-height 2) 20) screen-width :center)
; (love.graphics.setColor 0.75 0.75 0.75)
; (love.graphics.printf "Press D To Deploy" 0
; (+ (/ screen-height 2) 20) screen-width :center)
; (love.graphics.printf "Press Q To Quit" 0
; (+ (/ screen-height 2) 40) screen-width :center)
(love.graphics.printf
(: "Made with Love [%s.%s.%s] and Fennel"
:format major minor revision) footer-font 20 (- screen-height 30) screen-width :left)
(love.graphics.printf "A game by Bill Niblock" footer-font -20 (- screen-height 30) screen-width :right)
)
:keypressed
(fn keypressed [key set-mode]
(when (= key "d")
(set-mode :mode-play))
(when (= key "q")
(love.event.quit)))
:mousemoved
(fn mousemoved [x y]
(set (mx my) (values x y)))
}