Slides can now open custom views
This commit is contained in:
parent
c6f3f415b9
commit
3a70705efc
|
@ -3,6 +3,12 @@
|
||||||
(local {: parse} (util.require :presentation.engine))
|
(local {: parse} (util.require :presentation.engine))
|
||||||
(local core (require :core))
|
(local core (require :core))
|
||||||
(local style (require :core.style))
|
(local style (require :core.style))
|
||||||
|
(local TileEditView (require :editor.tileedit))
|
||||||
|
(local MapEditView (require :editor.mapedit))
|
||||||
|
(local PortraitEditView (require :editor.portraitedit))
|
||||||
|
(local FontEditView (require :editor.fontedit))
|
||||||
|
(local ScreenEditView (require :editor.screenedit))
|
||||||
|
|
||||||
(local h
|
(local h
|
||||||
{:style true
|
{:style true
|
||||||
:font (renderer.font.load "presentation/font/PrintChar21.ttf" (* 64 SCALE))
|
:font (renderer.font.load "presentation/font/PrintChar21.ttf" (* 64 SCALE))
|
||||||
|
@ -26,15 +32,19 @@
|
||||||
node (root:get_node_for_view view)]
|
node (root:get_node_for_view view)]
|
||||||
(when node (node:close_active_view root))))
|
(when node (node:close_active_view root))))
|
||||||
|
|
||||||
|
(fn split-and-open [f ?split]
|
||||||
|
(let [focused-view core.active_view
|
||||||
|
focused-node (core.root_view:get_active_node)
|
||||||
|
_ (when ?split (focused-node:split ?split))
|
||||||
|
view (f)
|
||||||
|
node (core.root_view:get_active_node)]
|
||||||
|
(when (= (core.root_view.root_node:get_node_for_view view) nil) (node:add_view view))
|
||||||
|
(when ?split (core.set_active_view focused-view)) ; don't switch focus
|
||||||
|
#(view-cleanup view)))
|
||||||
|
|
||||||
|
(fn openview [f ?split] {:action #(split-and-open f ?split)})
|
||||||
(fn openfile [filename ?split]
|
(fn openfile [filename ?split]
|
||||||
{:action (fn []
|
(openview #(core.root_view:open_doc (core.open_doc filename)) ?split))
|
||||||
(let [focused-view core.active_view
|
|
||||||
d (core.open_doc filename)
|
|
||||||
focused-node (core.root_view:get_active_node)
|
|
||||||
node (when ?split (focused-node:split ?split))
|
|
||||||
view (core.root_view:open_doc d)]
|
|
||||||
(when ?split (core.set_active_view focused-view)) ; don't switch focus
|
|
||||||
#(view-cleanup view)))})
|
|
||||||
|
|
||||||
(parse [
|
(parse [
|
||||||
[h "" "" ""
|
[h "" "" ""
|
||||||
|
@ -74,7 +84,7 @@
|
||||||
" :loop [:bne :loop]"
|
" :loop [:bne :loop]"
|
||||||
"Lexical scope with nested blocks"
|
"Lexical scope with nested blocks"
|
||||||
" [:block :loop (generate-loop-code) [:bne :loop]]"]
|
" [:block :loop (generate-loop-code) [:bne :loop]]"]
|
||||||
; ;; DEMO before tech dive
|
; ;; DEMO before tech dive??
|
||||||
[h "Wait WTF Is An Assembler"
|
[h "Wait WTF Is An Assembler"
|
||||||
** "It's just converting mnemonics to bytes, right?"
|
** "It's just converting mnemonics to bytes, right?"
|
||||||
{:image "presentation/pics/assembly-markup.png" :justify :center :pause-after true}
|
{:image "presentation/pics/assembly-markup.png" :justify :center :pause-after true}
|
||||||
|
@ -94,5 +104,29 @@
|
||||||
"\"Immediate words\" can be Fennel functions that generate code!"]
|
"\"Immediate words\" can be Fennel functions that generate code!"]
|
||||||
[h "Extensible Assembler??"
|
[h "Extensible Assembler??"
|
||||||
** "How do you turn code into bytes?"
|
** "How do you turn code into bytes?"
|
||||||
" [:vm 1 2 :+ :.]"]
|
" [:vm 1 2 :+ :.]"
|
||||||
|
"Branching?"
|
||||||
|
" (vm:if [:do-true-thing] [:do-false-thing])"
|
||||||
|
"I can even do short-circuiting OR!"
|
||||||
|
" (vm:if-or [[:dup 1 :=] [:dup 3 :=]] [:do-true-thing] [:do-false-thing])"]
|
||||||
|
[h "Step 3: Tooling And Workflow"
|
||||||
|
** "I want an environment that makes it easy to make graphical tools"
|
||||||
|
"I'm SO tired of web tech"
|
||||||
|
"Could LÖVE2D with an imgui work?"]
|
||||||
|
[h "lite"
|
||||||
|
** "A small, highly-extensible text editor written in Lua"
|
||||||
|
"Backend is SDL"
|
||||||
|
"Could I rewrite it to run under LÖVE2D?"
|
||||||
|
" Yes! In a weekend!"]
|
||||||
|
[h "Custom Editors"
|
||||||
|
** "14x16 tile editor"
|
||||||
|
(openview #(TileEditView))
|
||||||
|
"Font editor"
|
||||||
|
(openview #(FontEditView))
|
||||||
|
"Portrait editor"
|
||||||
|
(openview #(PortraitEditView))
|
||||||
|
"Map editor"
|
||||||
|
(openview #(MapEditView))
|
||||||
|
"Screen editor"
|
||||||
|
(lume.merge (openview #(ScreenEditView :neuttower/title.screen)) {:pause-after true})]
|
||||||
])
|
])
|
||||||
|
|
Loading…
Reference in a new issue