fix font and portrait editor
This commit is contained in:
parent
7b6893d6e3
commit
d17ae7873f
|
@ -2,18 +2,18 @@
|
|||
(local tiledraw (require :editor.tiledraw))
|
||||
(local tiles (require :game.tiles))
|
||||
(local style (require :core.style))
|
||||
(local files (require :game.files))
|
||||
|
||||
(local FontEditView (TileView:extend))
|
||||
|
||||
(fn FontEditView.tilesize [self] (values 8 8))
|
||||
(fn FontEditView.tilekeys [self] [:gfx])
|
||||
(fn FontEditView.map-bitxy [self x y] (values y x))
|
||||
(fn FontEditView.draw-tile-flags [self x y]
|
||||
(fn FontEditView.draw-sidebar [self {: x : y}]
|
||||
(when self.itile
|
||||
(local char (string.char (+ self.itile 0x20 -1)))
|
||||
(renderer.draw_text style.big_font char x y style.text))
|
||||
(love.graphics.setColor 1 1 1 1))
|
||||
(fn FontEditView.resource-key [self] :font)
|
||||
|
||||
(fn FontEditView.initial-style [self] :font)
|
||||
(fn FontEditView.get_name [self] "Font Editor")
|
||||
|
||||
FontEditView
|
||||
|
|
|
@ -6,20 +6,9 @@
|
|||
|
||||
(local PortraitView (TileView:extend))
|
||||
|
||||
(fn PortraitView.tilesize [self] (values 32 32))
|
||||
(fn PortraitView.tilekeys [self] [:gfx])
|
||||
(fn PortraitView.resource-key [self] :portraits)
|
||||
(fn PortraitView.map-bitxy [self x y]
|
||||
(local quadrant (+ (if (>= x 16) 2 0) (if (>= y 16) 1 0)))
|
||||
(local tilex
|
||||
(if (or (= x 0) (= x 30)) 0
|
||||
(or (= x 1) (= x 31)) 15
|
||||
(< x 16) (- x 1)
|
||||
(- x 15)))
|
||||
(local tiley (% y 16))
|
||||
(local (ibyte ibit) (PortraitView.super.map-bitxy self tilex tiley))
|
||||
(values (+ ibyte (* quadrant 32)) ibit))
|
||||
(fn PortraitView.draw-tile-flags [self form]
|
||||
(fn PortraitView.initial-style [self] :portraits)
|
||||
(fn PortraitView.draw-sidebar [self form]
|
||||
(local tile (-?> self.tilecache.tiles (. self.itile)))
|
||||
(when tile
|
||||
(set tile.label (textfield form "Label" tile.label))))
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
(local tiledraw (require :editor.tiledraw))
|
||||
|
||||
{:map-bitxy (fn [self x y]
|
||||
(fn map-bitxy-tile [x y]
|
||||
(when (and (>= x 0) (< x 16) (>= y 0) (< y 16))
|
||||
(local ibyte (if (< x 8) y (+ y 16)))
|
||||
(local ibit
|
||||
|
@ -8,6 +8,19 @@
|
|||
(< x 8) (- x 1)
|
||||
(- x 8)))
|
||||
(values ibyte ibit 1)))
|
||||
|
||||
(fn map-bitxy-portrait [x y]
|
||||
(local quadrant (+ (if (>= x 16) 2 0) (if (>= y 16) 1 0)))
|
||||
(local tilex
|
||||
(if (or (= x 0) (= x 30)) 0
|
||||
(or (= x 1) (= x 31)) 15
|
||||
(< x 16) (- x 1)
|
||||
(- x 15)))
|
||||
(local tiley (% y 16))
|
||||
(local (ibyte ibit) (map-bitxy-tile tilex tiley))
|
||||
(values (+ ibyte (* quadrant 32)) ibit 1))
|
||||
|
||||
{:map-bitxy (fn [self x y w] (if (> w 16) (map-bitxy-portrait x y) (map-bitxy-tile x y)))
|
||||
:pixel-color (fn [self b _ ibit]
|
||||
(if (= ibit 7) (tiledraw.pal-from-bit (= b 1))
|
||||
(= b 1) [255 255 255]
|
||||
|
|
|
@ -129,17 +129,19 @@
|
|||
(match (style-selector form self.style)
|
||||
new-style (self:set-style new-style)))
|
||||
|
||||
(fn TileView.draw-sidebar [self form]
|
||||
(self:draw-tile-flags form)
|
||||
(self:draw-tile-preview (under form)))
|
||||
|
||||
(fn TileView.draw [self]
|
||||
(self:draw_background style.background)
|
||||
(self:draw_scrollbar)
|
||||
(let [form (self:form)
|
||||
form-side (self:form)
|
||||
full-width {:w form.w}]
|
||||
(self:draw-tile-editor form (self:tile))
|
||||
|
||||
; layout sidebar
|
||||
(self:draw-tile-flags (right-of form {:into form-side}))
|
||||
(self:draw-tile-preview (under form-side))
|
||||
(self:draw-sidebar (right-of form {:into {}}))
|
||||
|
||||
; continue laying out under tile editor
|
||||
(self:draw-tile-palette (under form full-width))
|
||||
|
|
Loading…
Reference in a new issue