From c6f3f415b96a250528a51b69b395a9548a2da7f4 Mon Sep 17 00:00:00 2001 From: Jeremy Penner Date: Mon, 28 Jun 2021 23:05:17 -0400 Subject: [PATCH] Slides can now open files --- NeutTower.dsk | Bin 143361 -> 143360 bytes editor/mapedit.fnl | 3 ++- presentation/engine.fnl | 10 +++++++++ presentation/slides.fnl | 45 +++++++++++++++++++++++----------------- 4 files changed, 38 insertions(+), 20 deletions(-) diff --git a/NeutTower.dsk b/NeutTower.dsk index d87c1a575493180f468ae500f7df6a0f442334fc..80b536d50cac787c36e313c01e0cfe4da4702919 100644 GIT binary patch delta 117 zcmV-*0E+*C;0S==2(WKmLCdn2z!a%gyls&k4*9e#`9@lJt&_}iE~qw`B-E7#)(q63 z(=I{lQ50J12Ccr09wG>Tuz}knOW?z@rq%)t#AmaxT~=%Yz=e|t$~Y7S0T2NJ1`7ub X2LS;B0TBfW0|W_!RLZwh$^oopTeU9j delta 119 zcmV--0Eqv9;0S@>2(WKmLG{qcCr3qe%B4lq*I?txkIDp&;7o&>RA%4f0zeLDf$>%D zB#aGArP1h0141~q#RfpIj72I{l0T~=%Y005H+$~Y7O2@wMj1qA^S Z2m=BF0RsaK2LuR%RLZwh$^oop0SXFfF0cRq diff --git a/editor/mapedit.fnl b/editor/mapedit.fnl index 25226bb..0e286f9 100644 --- a/editor/mapedit.fnl +++ b/editor/mapedit.fnl @@ -186,7 +186,8 @@ (fn advanced? [object] (or object.advanced (and (= object.advanced nil) - object.func))) + (not= object.func "") + (not= object.func nil)))) (fn MapEditView.draw-object-advanced-editor [self object x y] (let [(func y) (textfield self "Word" object.func x y 100 200) diff --git a/presentation/engine.fnl b/presentation/engine.fnl index 2fcdf01..e4cd404 100644 --- a/presentation/engine.fnl +++ b/presentation/engine.fnl @@ -19,22 +19,32 @@ (set self.imagecache {}) (set self.islide 1) (set self.ielem 0) + (set self.cleanup {}) (self:advance)) +(fn SlideshowView.cleanup-slide [self] + (each [_ f (pairs self.cleanup)] (f)) + (set self.cleanup {})) + (fn SlideshowView.next-slide [self] (set self.islide (if (>= self.islide (length self.slides)) 1 (+ self.islide 1))) (set self.ielem 0) + (self:cleanup-slide) (self:advance)) (fn SlideshowView.prev-slide [self] (set self.islide (if (<= self.islide 1) (length self.slides) (- self.islide 1))) (set self.ielem (+ 1 (length (. self.slides self.islide)))) + (self:cleanup-slide) (self:back)) (fn SlideshowView.ielemNext [self ielem di] (let [slide (. self.slides self.islide) elem (. slide ielem)] (when elem + (when elem.action + (if (= di 1) (tset self.cleanup ielem (elem:action)) + (. self.cleanup ielem) ((. self.cleanup ielem)))) (if elem.pause-after ielem (self:ielemNext (+ ielem di) di))))) diff --git a/presentation/slides.fnl b/presentation/slides.fnl index 6e93e09..df8ef28 100644 --- a/presentation/slides.fnl +++ b/presentation/slides.fnl @@ -1,6 +1,7 @@ (local util (require :lib.util)) (local lume (require :lib.lume)) (local {: parse} (util.require :presentation.engine)) +(local core (require :core)) (local style (require :core.style)) (local h {:style true @@ -20,9 +21,25 @@ (fn bgimg [filename] {:image filename :justify :center :overlay true :alpha 0.3 :topPadding 0}) +(fn view-cleanup [view] + (let [root core.root_view.root_node + node (root:get_node_for_view view)] + (when node (node:close_active_view root)))) + +(fn openfile [filename ?split] + {:action (fn [] + (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 [ - [h "" "" - "Honeylisp" "" + [h "" "" "" + "Honeylisp" + "" "" "" (np **) "Jeremy Penner" "https://spindleyq.itch.io/" "https://blog.information-superhighway.net/" @@ -43,31 +60,21 @@ ** "In 2020, I did the Global Game Jam on my 286." "Finished 'Shareware Episode 1' a couple of months later."] [h "The Idea" - ** "What if I took a similar DIY approach with modern tools?" + ** "What if I took a similar DIY approach with modern tooling?" "* I'd done Forth; what about Lisp?" + " https://fennel-lang.org/" "* How far can I push fast iterative development?" "* Could I integrate an editor?" "* How can I leverage emulation?"] - [h "Honeylisp" - ** "* Written in Fennel, a Lisp that compiles to Lua" - "* Assembler" - "* Forth-like 'virtual machine' / inner interpreter" - "* 'lite' editor, ported to love2d" - " * Integrated custom editors" - "* MAME integration" - " * Upload new builds directly into RAM" - " * Interactive code injection" - " * Hot code reload" - "* Tape upload" - "* ProDOS disk image generation"] - ;; DEMO before tech dive - [h "Assembler" - ** "Represent instructions using Fennel data literals" + [h "Step 1: Assembler" + ** "Represent instructions using Fennel data literals" + (openfile :asm/asm.fnl :right) " [:lda 0xff]" "Represent labels with Fennel strings" " :loop [:bne :loop]" "Lexical scope with nested blocks" " [:block :loop (generate-loop-code) [:bne :loop]]"] +; ;; DEMO before tech dive [h "Wait WTF Is An Assembler" ** "It's just converting mnemonics to bytes, right?" {:image "presentation/pics/assembly-markup.png" :justify :center :pause-after true} @@ -78,7 +85,7 @@ " [:db 123] [:dw 12345] [:bytes \"HELLO WORLD\"] [:ref :hello]" "Must be able to line up bytes on page boundaries" " [:align 0x100]"] - [h "Virtual Machine" + [h "Step 2: Virtual Machine" {:image "presentation/pics/thinkhard.png" :justify :center} ** "Not super keen on writing a complicated compiler" "I'm already very comfortable with Forth"