31 lines
965 B
Fennel
31 lines
965 B
Fennel
(require :editor.lite)
|
|
(local TileView (require :editor.tileedit))
|
|
(local core (require :core))
|
|
(local command (require :core.command))
|
|
(local keymap (require :core.keymap))
|
|
|
|
(command.add nil {
|
|
"honeylisp:edit-tiles" (fn []
|
|
(local node (core.root_view:get_active_node))
|
|
(node:add_view (TileView))) ; allow hot reload
|
|
})
|
|
|
|
(command.add :editor.tileedit {
|
|
"tileedit:save" (fn [] (core.active_view:save) (core.log "Saved tiles"))
|
|
"tileedit:next-tile" #(core.active_view:select-rel 1)
|
|
"tileedit:previous-tile" #(core.active_view:select-rel -1)
|
|
"tileedit:copy" #(system.set_clipboard (: (core.active_view:tile) :tohex))
|
|
"tileedit:paste"
|
|
#(when (= (length (system.get_clipboard)) 64)
|
|
(core.active_view:update-tile (: (system.get_clipboard) :fromhex)))
|
|
})
|
|
|
|
(keymap.add {
|
|
"ctrl+s" "tileedit:save"
|
|
"left" "tileedit:previous-tile"
|
|
"right" "tileedit:next-tile"
|
|
"ctrl+c" "tileedit:copy"
|
|
"ctrl+v" "tileedit:paste"
|
|
})
|
|
|