Slides can now open files

This commit is contained in:
Jeremy Penner 2021-06-28 23:05:17 -04:00
parent f3cb823e0f
commit c6f3f415b9
4 changed files with 38 additions and 20 deletions

Binary file not shown.

View file

@ -186,7 +186,8 @@
(fn advanced? [object] (fn advanced? [object]
(or object.advanced (or object.advanced
(and (= object.advanced nil) (and (= object.advanced nil)
object.func))) (not= object.func "")
(not= object.func nil))))
(fn MapEditView.draw-object-advanced-editor [self object x y] (fn MapEditView.draw-object-advanced-editor [self object x y]
(let [(func y) (textfield self "Word" object.func x y 100 200) (let [(func y) (textfield self "Word" object.func x y 100 200)

View file

@ -19,22 +19,32 @@
(set self.imagecache {}) (set self.imagecache {})
(set self.islide 1) (set self.islide 1)
(set self.ielem 0) (set self.ielem 0)
(set self.cleanup {})
(self:advance)) (self:advance))
(fn SlideshowView.cleanup-slide [self]
(each [_ f (pairs self.cleanup)] (f))
(set self.cleanup {}))
(fn SlideshowView.next-slide [self] (fn SlideshowView.next-slide [self]
(set self.islide (if (>= self.islide (length self.slides)) 1 (+ self.islide 1))) (set self.islide (if (>= self.islide (length self.slides)) 1 (+ self.islide 1)))
(set self.ielem 0) (set self.ielem 0)
(self:cleanup-slide)
(self:advance)) (self:advance))
(fn SlideshowView.prev-slide [self] (fn SlideshowView.prev-slide [self]
(set self.islide (if (<= self.islide 1) (length self.slides) (- self.islide 1))) (set self.islide (if (<= self.islide 1) (length self.slides) (- self.islide 1)))
(set self.ielem (+ 1 (length (. self.slides self.islide)))) (set self.ielem (+ 1 (length (. self.slides self.islide))))
(self:cleanup-slide)
(self:back)) (self:back))
(fn SlideshowView.ielemNext [self ielem di] (fn SlideshowView.ielemNext [self ielem di]
(let [slide (. self.slides self.islide) (let [slide (. self.slides self.islide)
elem (. slide ielem)] elem (. slide ielem)]
(when elem (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 (if elem.pause-after ielem
(self:ielemNext (+ ielem di) di))))) (self:ielemNext (+ ielem di) di)))))

View file

@ -1,6 +1,7 @@
(local util (require :lib.util)) (local util (require :lib.util))
(local lume (require :lib.lume)) (local lume (require :lib.lume))
(local {: parse} (util.require :presentation.engine)) (local {: parse} (util.require :presentation.engine))
(local core (require :core))
(local style (require :core.style)) (local style (require :core.style))
(local h (local h
{:style true {:style true
@ -20,9 +21,25 @@
(fn bgimg [filename] {:image filename :justify :center :overlay true :alpha 0.3 :topPadding 0}) (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 [ (parse [
[h "" "" [h "" "" ""
"Honeylisp" "" "Honeylisp"
"" "" ""
(np **) "Jeremy Penner" (np **) "Jeremy Penner"
"https://spindleyq.itch.io/" "https://spindleyq.itch.io/"
"https://blog.information-superhighway.net/" "https://blog.information-superhighway.net/"
@ -43,31 +60,21 @@
** "In 2020, I did the Global Game Jam on my 286." ** "In 2020, I did the Global Game Jam on my 286."
"Finished 'Shareware Episode 1' a couple of months later."] "Finished 'Shareware Episode 1' a couple of months later."]
[h "The Idea" [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?" "* I'd done Forth; what about Lisp?"
" https://fennel-lang.org/"
"* How far can I push fast iterative development?" "* How far can I push fast iterative development?"
"* Could I integrate an editor?" "* Could I integrate an editor?"
"* How can I leverage emulation?"] "* How can I leverage emulation?"]
[h "Honeylisp" [h "Step 1: Assembler"
** "* 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" ** "Represent instructions using Fennel data literals"
(openfile :asm/asm.fnl :right)
" [:lda 0xff]" " [:lda 0xff]"
"Represent labels with Fennel strings" "Represent labels with Fennel strings"
" :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
[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}
@ -78,7 +85,7 @@
" [:db 123] [:dw 12345] [:bytes \"HELLO WORLD\"] [:ref :hello]" " [:db 123] [:dw 12345] [:bytes \"HELLO WORLD\"] [:ref :hello]"
"Must be able to line up bytes on page boundaries" "Must be able to line up bytes on page boundaries"
" [:align 0x100]"] " [:align 0x100]"]
[h "Virtual Machine" [h "Step 2: Virtual Machine"
{:image "presentation/pics/thinkhard.png" :justify :center} {:image "presentation/pics/thinkhard.png" :justify :center}
** "Not super keen on writing a complicated compiler" ** "Not super keen on writing a complicated compiler"
"I'm already very comfortable with Forth" "I'm already very comfortable with Forth"