initial commit
This commit is contained in:
commit
c18896def0
30 changed files with 4183 additions and 0 deletions
29
src/fnl/demo.fnl
Normal file
29
src/fnl/demo.fnl
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
(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))))
|
||||
Loading…
Add table
Add a link
Reference in a new issue