Fix canvas size.
This commit is contained in:
parent
6909ea5d4e
commit
6463ce4432
|
@ -2,7 +2,8 @@
|
||||||
(var time 0)
|
(var time 0)
|
||||||
|
|
||||||
{:draw (fn draw [message]
|
{: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]
|
:update (fn update [dt set-mode]
|
||||||
(if (< counter 65535)
|
(if (< counter 65535)
|
||||||
(set counter (+ counter 1))
|
(set counter (+ counter 1))
|
||||||
|
|
12
wrap.fnl
12
wrap.fnl
|
@ -1,5 +1,6 @@
|
||||||
(local repl (require "lib.stdio"))
|
(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)
|
(var scale 1)
|
||||||
|
|
||||||
|
@ -16,6 +17,8 @@
|
||||||
(repl.start))
|
(repl.start))
|
||||||
|
|
||||||
(fn love.draw []
|
(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.setCanvas canvas)
|
||||||
(love.graphics.clear)
|
(love.graphics.clear)
|
||||||
(love.graphics.setColor 1 1 1)
|
(love.graphics.setColor 1 1 1)
|
||||||
|
@ -25,14 +28,11 @@
|
||||||
(love.graphics.draw canvas 0 0 0 scale scale))
|
(love.graphics.draw canvas 0 0 0 scale scale))
|
||||||
|
|
||||||
(fn love.update[dt]
|
(fn love.update[dt]
|
||||||
(mode.update dt set-mode)
|
(mode.update dt set-mode))
|
||||||
)
|
|
||||||
|
|
||||||
(fn love.keypressed [key]
|
(fn love.keypressed [key]
|
||||||
(if
|
(if
|
||||||
(and (love.keyboard.isDown "lctrl" "rctrl" "capslock") (= key "q"))
|
(and (love.keyboard.isDown "lctrl" "rctrl" "capslock") (= key "q"))
|
||||||
(love.event.quit)
|
(love.event.quit)
|
||||||
;; add what each keypress should do in each mode
|
;; add what each keypress should do in each mode
|
||||||
(mode.keypressed key set-mode)
|
(mode.keypressed key set-mode)))
|
||||||
))
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue