Browse Source

Change when triggers get processed

master
Macoy Madson 5 months ago
parent
commit
a70fd4882c
  1. 3
      data/DrivingCodeWithData.cakedata
  2. 20
      src/Presentation.cake

3
data/DrivingCodeWithData.cakedata

@ -199,7 +199,8 @@ EndIf EndIf")
(slide-data :heading "Can I author that data in a better way?")
(slide-data :heading "How do I expect the problem, data,
and feature to grow?"
:body "How are they actually growing?")
:body "
How are they actually growing?")
(slide-data :heading "Am I building a complicated generic system
before knowing it is necessary?")
(slide-data :heading "In conclusion"

20
src/Presentation.cake

@ -406,27 +406,33 @@
(set exit-reason "Quit keybind pressed"))
;; Slide motion
(var start-frame-slide-index int current-slide-index)
(when (keybind-tapped (addr s-next-slide-keybind) (addr s-key-states))
(set slide-start-ticks (SDL_GetPerformanceCounter))
(incr current-slide-index)
(unless (at 0 (field (at current-slide-index (field presentation slides)) heading))
(set current-slide-index (- current-slide-index 1)))
(set current-slide-index (- current-slide-index 1))))
(when (keybind-tapped (addr s-previous-slide-keybind) (addr s-key-states))
(set slide-start-ticks (SDL_GetPerformanceCounter))
(decr current-slide-index)
(when (< current-slide-index 0)
(set current-slide-index 0)))
;; Slide changed; handle triggers
(when (!= start-frame-slide-index current-slide-index)
(var current-slide (* slide-data)
(addr (at current-slide-index (field presentation slides))))
(when (at 0 (path current-slide > trigger))
(cond
((= 0 (strcmp (path current-slide > trigger) "enter-wizard"))
(set wizard-animation-start-ticks (SDL_GetPerformanceCounter))
(set current-wizard-animation (addr anim-wizard-attack))
(set render-wizard true))
((= 0 (strcmp (path current-slide > trigger) "enter-boar"))
(set boar-animation-start-ticks (SDL_GetPerformanceCounter))
(set current-boar-animation (addr anim-boar-jump-in))
(set render-boar true))
(true
(preslog "Unrecognized trigger: %s" (path current-slide > trigger))))))
(when (keybind-tapped (addr s-previous-slide-keybind) (addr s-key-states))
(set slide-start-ticks (SDL_GetPerformanceCounter))
(decr current-slide-index)
(when (< current-slide-index 0)
(set current-slide-index 0)))
;; Debug keys
(when (keybind-tapped (addr s-toggle-kerning-keybind) (addr s-key-states))

Loading…
Cancel
Save