17 lines
631 B
Fennel
17 lines
631 B
Fennel
(local {: pal : gs-to-rgb} (require :editor.tiledraw.iigs))
|
|
(local lume (require :lib.lume))
|
|
|
|
{:map-bitxy (fn [self x y w h] (values (+ (* y w) x) 0 0xff))
|
|
:pixel-color (fn [self b] (match b 0xf0 (values [128 128 128] [64 64 64])
|
|
_ (gs-to-rgb (. pal (+ b 1)))))
|
|
:draw-bits #(if (= $1.icolor 17) 0xf0 (- $1.icolor 1))
|
|
:palette #(lume.concat (icollect [_ color (ipairs pal)] (gs-to-rgb color)) [[255 0 255]])
|
|
:pixel-storage-divisor #1
|
|
:blank-tile-byte #"\xf0"
|
|
:preview-locations (fn [self]
|
|
(match self.style
|
|
:iso [[12 0] [0 6] [24 6] [12 12]]
|
|
_ [[0 0] [12 0] [0 12] [12 12]]))
|
|
}
|
|
|