Fix mapedit layout, add inspector helper function for when pretty-print debugging is ugly
This commit is contained in:
parent
939cfc6065
commit
a9b54cc890
|
@ -50,7 +50,7 @@
|
|||
(when (and w h)
|
||||
(when (= itile selected-itile)
|
||||
(love.graphics.rectangle :line (- x 2) (- y 2) (+ w 4) (+ h 4)))
|
||||
(when (g wrap form button {:tag [:tile itile] : w : h})
|
||||
(when (wrap form #(g button $...) {:tag [:tile itile] : w : h})
|
||||
(set selected-itile itile)))))
|
||||
(g form)
|
||||
selected-itile))
|
||||
|
|
|
@ -372,6 +372,7 @@
|
|||
(set viewfn-or-form.y group.y)
|
||||
(set viewfn-or-form.w group.w)
|
||||
(set viewfn-or-form.h group.h)
|
||||
(lume.clear group)
|
||||
viewfn-or-form)))))
|
||||
|
||||
{: attach-imstate : cmd-predicate : postpone : mouse-inside : activate : active?
|
||||
|
|
|
@ -261,20 +261,19 @@
|
|||
(if (advanced? object)
|
||||
(self:draw-object-advanced-editor form object)
|
||||
(self:draw-object-code-editor form object))
|
||||
(set self.new-flag-name (footer horiz form textbox {:tag :new-flag-name :w (* 200 SCALE)} self.new-flag-name))
|
||||
(when (footer horiz form textbutton {} "+ New Flag")
|
||||
(set self.new-flag-name (horiz form #(footer textbox $...) {:tag :new-flag-name :w (* 200 SCALE)} self.new-flag-name))
|
||||
(when (horiz form #(footer textbutton $...) {} "+ New Flag")
|
||||
(when (= files.game.flags nil)
|
||||
(set files.game.flags []))
|
||||
(table.insert files.game.flags self.new-flag-name)
|
||||
(set self.new-flag-name ""))
|
||||
(footer form)
|
||||
(when (footer vert form textbutton {} "Delete")
|
||||
(vert (footer form))
|
||||
(when (horiz form #(footer textbutton $...) {} "Delete")
|
||||
(move-object self.level.objects (+ self.iobject 1) self.iobject)
|
||||
(set self.iobject nil))
|
||||
(when (footer textbutton (lume.merge form {:x (+ form.x (* 150 SCALE))}) (if (advanced? object) "Simple" "Advanced"))
|
||||
(when (horiz form #(footer textbutton $...) {} (if (advanced? object) "Simple" "Advanced"))
|
||||
(set object.advanced (not (advanced? object))))
|
||||
(footer form)
|
||||
(vert form)))
|
||||
(vert (footer form))))
|
||||
|
||||
(fn MapEditView.load-level [self]
|
||||
(set self.stripcache {})
|
||||
|
|
|
@ -13,6 +13,7 @@
|
|||
(set self.cmd "")
|
||||
(set self.scrollheight math.huge)
|
||||
(set self.scrollable true)
|
||||
(set self.title "REPL")
|
||||
(self.conn:listen self))
|
||||
|
||||
(fn ReplView.try_close [self do_close]
|
||||
|
@ -63,5 +64,7 @@
|
|||
(when pin-to-bottom
|
||||
(set self.scroll.to.y (- self.scrollheight self.size.y))))
|
||||
|
||||
(fn ReplView.get_name [self] self.title)
|
||||
|
||||
ReplView
|
||||
|
||||
|
|
|
@ -102,7 +102,7 @@
|
|||
(when (= icolor selected-color)
|
||||
(love.graphics.setColor 1 1 1 1)
|
||||
(love.graphics.rectangle :line (- form.x 2) (- form.y 2) (+ pixel-size 4) (+ pixel-size 4)))
|
||||
(when (g wrap form button {:tag [:pal icolor] :w pixel-size :h pixel-size})
|
||||
(when (wrap form #(g button $...) {:tag [:pal icolor] :w pixel-size :h pixel-size})
|
||||
(set selected-color icolor)))
|
||||
(g form)
|
||||
selected-color))
|
||||
|
|
30
inspector/debug.fnl
Normal file
30
inspector/debug.fnl
Normal file
|
@ -0,0 +1,30 @@
|
|||
(local core (require :core))
|
||||
(local style (require :core.style))
|
||||
(local util (require :lib.util))
|
||||
(local repl (require :editor.repl))
|
||||
(local ReplView (require :editor.replview))
|
||||
|
||||
(local module (util.hot-table ...))
|
||||
|
||||
(fn find-existing-inspector-window [name]
|
||||
(var result nil)
|
||||
(each [_ view (ipairs (core.root_view.root_node:get_children)) :until result]
|
||||
(when (= view.inspector-name name)
|
||||
(set result view)))
|
||||
result)
|
||||
|
||||
(fn create-inspector-window [name ?value]
|
||||
(let [node (core.root_view:get_active_node)
|
||||
conn (repl.new)
|
||||
view (ReplView conn)]
|
||||
(set view.inspector-name name)
|
||||
(set view.title name)
|
||||
(view:append {:draw (fn [_ _ x y] (renderer.draw_text style.font name x y style.text) (+ (style.font:get_height) style.padding.y))})
|
||||
(view:append (repl.mk-result [?value]))
|
||||
(node:add_view view)))
|
||||
|
||||
(lambda module.show [name ?value]
|
||||
(when (= (find-existing-inspector-window name) nil)
|
||||
(create-inspector-window name ?value)))
|
||||
|
||||
module.hot
|
File diff suppressed because one or more lines are too long
Loading…
Reference in a new issue