42 lines
1.4 KiB
Fennel
42 lines
1.4 KiB
Fennel
(require :editor.lite)
|
|
(local util (require :lib.util))
|
|
(local TileView (require :editor.tileedit))
|
|
(local MapEditView (require :editor.mapedit))
|
|
(local {: cmd-predicate} (util.require :editor.imstate))
|
|
(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)))
|
|
"honeylisp:edit-map" (fn []
|
|
(local node (core.root_view:get_active_node))
|
|
(node:add_view (MapEditView))
|
|
)
|
|
})
|
|
|
|
(command.add (cmd-predicate :editor.gfxedit) {
|
|
"graphics-editor:save" (fn [] (core.active_view:save) (core.log "Saved"))
|
|
"graphics-editor:reload" (fn [] (core.active_view:reload) (core.log "Reloaded"))
|
|
"graphics-editor:next-tile" #(core.active_view:select-rel 1)
|
|
"graphics-editor:previous-tile" #(core.active_view:select-rel -1)
|
|
})
|
|
(command.add (cmd-predicate :editor.tileedit) {
|
|
"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" "graphics-editor:save"
|
|
"alt+r" "graphics-editor:reload"
|
|
"left" "graphics-editor:previous-tile"
|
|
"right" "graphics-editor:next-tile"
|
|
"ctrl+c" "tileedit:copy"
|
|
"ctrl+v" "tileedit:paste"
|
|
})
|
|
|