Browse Source

Fix HotReload crashing

* Update Cakelisp for HotReloading copy lib to Active version so it
the original can be modified (otherwise, it can cause a crash)
* Only reload on key release so it isn't reloaded for as long as the
user holds the key (many times per quick press, even)
pitch-detection
Macoy Madson 3 years ago
parent
commit
8e4b29844d
  1. 4
      Build_Debug.sh
  2. 2
      Dependencies/cakelisp
  3. 9
      test/src/VocalGame.cake

4
Build_Debug.sh

@ -14,10 +14,10 @@ echo "\n\nVocal Game (hot reload)\n\n"
./Dependencies/cakelisp/bin/cakelisp test/src/MakeHotReload.cake test/src/VocalGame.cake || exit $?
echo "\n\nLoader\n\n"
./Dependencies/cakelisp/bin/cakelisp --execute test/src/Loader.cake || exit $?
./Dependencies/cakelisp/bin/cakelisp test/src/Loader.cake || exit $?
echo "\n\nVocal Game (no reload)\n\n"
./Dependencies/cakelisp/bin/cakelisp --execute test/src/NoHotReload.cake test/src/VocalGame.cake || exit $?
./Dependencies/cakelisp/bin/cakelisp test/src/NoHotReload.cake test/src/VocalGame.cake || exit $?
# echo "\n\nAuto Test\n\n"
# ../cakelisp/bin/cakelisp --verbose-processes src/AutoTest.cake src/SDL.cake src/Tracy.cake

2
Dependencies/cakelisp

@ -1 +1 @@
Subproject commit 856dc37aea01812f08227e06f486b037251eb774
Subproject commit ec5c500639f1898a49a863782f9e4794e55095bd

9
test/src/VocalGame.cake

@ -338,6 +338,9 @@
(var counter-num-ticks-per-second (const Uint64) (SDL_GetPerformanceFrequency))
(var last-frame-perf-count Uint64 (* 0.016f counter-num-ticks-per-second))
;; "Debounce" via only reloading on key release
(var was-reload-pressed bool false)
;; Main loop
(while (not exit-reason)
(var event SDL_Event)
@ -350,7 +353,11 @@
(when (at SDL_SCANCODE_ESCAPE currentKeyStates)
(set exit-reason "Escape pressed"))
(when (at SDL_SCANCODE_R currentKeyStates)
(var reload-pressed bool (at SDL_SCANCODE_R currentKeyStates))
(when reload-pressed
(set was-reload-pressed true))
(when (and (not reload-pressed) was-reload-pressed)
(set was-reload-pressed false)
(printf "\nReloading\n\n")
;; Our audio callbacks are going away!
;; The SDL_QueueAudio() API would make this easier to deal with, but then I need to manage

Loading…
Cancel
Save