diff --git a/mode-intro.fnl b/mode-intro.fnl index 379058b..42135b8 100644 --- a/mode-intro.fnl +++ b/mode-intro.fnl @@ -2,7 +2,8 @@ (var time 0) {:draw (fn draw [message] - (love.graphics.print "This window should close in 3s") 32 16) + (love.graphics.print (: "This window should close in %0.2f seconds" + :format (- 3 time))) 32 16) :update (fn update [dt set-mode] (if (< counter 65535) (set counter (+ counter 1)) diff --git a/wrap.fnl b/wrap.fnl index 721ca3b..791e0a5 100644 --- a/wrap.fnl +++ b/wrap.fnl @@ -1,5 +1,6 @@ (local repl (require "lib.stdio")) -(local canvas (love.graphics.newCanvas 720 450)) +(local canvas (let [(w h) (love.window.getMode)] + (love.graphics.newCanvas w h))) (var scale 1) @@ -12,10 +13,12 @@ (mode.activate ...))) (fn love.load [] - (: canvas :setFilter "nearest" "nearest") + (: canvas :setFilter "nearest" "nearest") (repl.start)) (fn love.draw [] + ;; the canvas allows you to get sharp pixel-art style scaling; if you + ;; don't want that, just skip that and call mode.draw directly. (love.graphics.setCanvas canvas) (love.graphics.clear) (love.graphics.setColor 1 1 1) @@ -25,14 +28,11 @@ (love.graphics.draw canvas 0 0 0 scale scale)) (fn love.update[dt] - (mode.update dt set-mode) - ) + (mode.update dt set-mode)) (fn love.keypressed [key] (if (and (love.keyboard.isDown "lctrl" "rctrl" "capslock") (= key "q")) (love.event.quit) ;; add what each keypress should do in each mode - (mode.keypressed key set-mode) - )) - + (mode.keypressed key set-mode)))