Fix canvas size.
This commit is contained in:
parent
6909ea5d4e
commit
6463ce4432
|
@ -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))
|
||||
|
|
14
wrap.fnl
14
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)))
|
||||
|
|
Loading…
Reference in a new issue