one one line stuff
This commit is contained in:
parent
d8c17c429e
commit
050c02b3b0
1 changed files with 29 additions and 6 deletions
|
|
@ -3,6 +3,9 @@
|
|||
(local canvas-h (* scale 31))
|
||||
(local canvas-x (* -1 (/ canvas-w 2)))
|
||||
(local canvas-y (* -1 (/ canvas-h 2)))
|
||||
(local app-state {
|
||||
:mode :draw ; draw or preview
|
||||
})
|
||||
(local theme {
|
||||
:white (lambda [cb] (cb (love.math.colorFromBytes 247 246 246)))
|
||||
:black (lambda [cb] (cb (love.math.colorFromBytes 60 54 51)))
|
||||
|
|
@ -18,14 +21,16 @@
|
|||
|
||||
; setup pixels for image that we are drawing
|
||||
(var pixel-canvas nil)
|
||||
(local pixels {})
|
||||
(tset pixels :ordered-keys [])
|
||||
(tset pixels :cords {})
|
||||
(local pixels {
|
||||
:export-ordered-keys []
|
||||
:drawn-ordered-keys []
|
||||
:cords {}
|
||||
})
|
||||
(for [y 1 31]
|
||||
(for [x 1 88]
|
||||
(let [key (.. x "," y)]
|
||||
(tset pixels.cords key {: x : y :val false})
|
||||
(table.insert pixels.ordered-keys key))))
|
||||
(table.insert pixels.export-ordered-keys key))))
|
||||
|
||||
(fn draw-canvases []
|
||||
"Draw main drawing canvas and preview canvas to screen"
|
||||
|
|
@ -55,8 +60,10 @@
|
|||
key (.. x "," y)
|
||||
]
|
||||
(tset (. pixels.cords key) :val true)
|
||||
(table.insert pixels.drawn-ordered-keys key)
|
||||
(update-canvas)
|
||||
(print (.. x "," y))))))
|
||||
; (print (.. x "," y))
|
||||
))))
|
||||
|
||||
(fn love.load []
|
||||
;; 480p 720×480
|
||||
|
|
@ -82,6 +89,19 @@ while 1 do love.event.push('stdin', io.read('*line')) end") :start))
|
|||
; preview outline and text
|
||||
(love.graphics.print "Preview:" canvas-x (- canvas-y 80))
|
||||
(love.graphics.rectangle "line" canvas-x (- canvas-y 60) 89 32)
|
||||
|
||||
; future preview outlines and text
|
||||
(for [i 0 4]
|
||||
(let [
|
||||
gap (/ (- canvas-w (* 5 89)) 4)
|
||||
txt (case i
|
||||
0 "After 1 day"
|
||||
1 "After 2 days"
|
||||
2 "After 3 days"
|
||||
3 "After 4 days"
|
||||
4 "After 5 days")]
|
||||
(love.graphics.print txt (+ (* i (+ 89 gap)) canvas-x) (+ (+ 20 canvas-h) canvas-y))
|
||||
(love.graphics.rectangle "line" (+ (* i (+ 89 gap)) canvas-x) (+ (+ 40 canvas-h) canvas-y) 89 32)))
|
||||
)
|
||||
|
||||
(fn love.draw []
|
||||
|
|
@ -92,5 +112,8 @@ while 1 do love.event.push('stdin', io.read('*line')) end") :start))
|
|||
(draw-canvases)
|
||||
(love.graphics.pop))
|
||||
|
||||
; (fn love.keypressed [key]
|
||||
(fn love.keypressed [key]
|
||||
(match key
|
||||
"d" (tset app-state :mode "draw")
|
||||
"p" (tset app-state :mode "preview")))
|
||||
; (love.event.quit))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue