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]
(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)

View file

@ -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)))))

View file

@ -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"