30 lines
714 B
Text
30 lines
714 B
Text
|
|
(local pxl8 (require :pxl8))
|
||
|
|
|
||
|
|
(var frame 0)
|
||
|
|
(var pxl8-sprite-id nil)
|
||
|
|
(var screen nil)
|
||
|
|
(var time 0)
|
||
|
|
|
||
|
|
(global init (fn []
|
||
|
|
(pxl8.load_palette "./res/palettes/gruvbox.ase")
|
||
|
|
(set pxl8-sprite-id (pxl8.load_sprite "./res/sprites/pxl8.ase"))
|
||
|
|
(set screen (pxl8.get_screen))
|
||
|
|
(when (not pxl8-sprite-id)
|
||
|
|
(pxl8.error "Failed to load pxl8 sprite"))))
|
||
|
|
|
||
|
|
(global update (fn [dt]))
|
||
|
|
|
||
|
|
(global draw (fn []
|
||
|
|
(pxl8.clr 1)
|
||
|
|
(local cols 5)
|
||
|
|
(local rows 1024)
|
||
|
|
(local sprite-w 128)
|
||
|
|
(local sprite-h 64)
|
||
|
|
|
||
|
|
(for [i 0 8192]
|
||
|
|
(local col (% i cols))
|
||
|
|
(local row (math.floor (/ i cols)))
|
||
|
|
(local x (* col (+ sprite-w 4)))
|
||
|
|
(local y (* row (+ sprite-h 2)))
|
||
|
|
(pxl8.sprite pxl8-sprite-id x y sprite-w sprite-h))))
|