summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Thompson <dthompson2@worcester.edu>2021-09-13 08:22:14 -0400
committerDavid Thompson <dthompson2@worcester.edu>2021-09-21 20:17:36 -0400
commit70fe66040fcac1411eacc495beae88cb66495ac7 (patch)
tree30152e31572e70d049d240f882505994a5078f6f
parent4adeba1393463696a0dbf0fd770f455c3f89bf19 (diff)
Flush all SDL input events after running error handler.
-rw-r--r--chickadee.scm7
1 files changed, 6 insertions, 1 deletions
diff --git a/chickadee.scm b/chickadee.scm
index bffb83c..9956b16 100644
--- a/chickadee.scm
+++ b/chickadee.scm
@@ -386,6 +386,11 @@ border is disabled, otherwise it is enabled.")
(with-projection (atomic-box-ref default-projection)
(draw alpha)))
(sdl2:swap-gl-window (unwrap-window window)))
+ (define (on-error stack key args)
+ (error stack key args)
+ ;; Flush all input events that have occurred while in the error
+ ;; state.
+ (while (poll-event) #t))
(dynamic-wind
(const #t)
(lambda ()
@@ -408,7 +413,7 @@ border is disabled, otherwise it is enabled.")
(scope-datadir "gamecontrollerdb.txt"))
(run-game* #:update update-sdl
#:render render-sdl-opengl
- #:error error
+ #:error on-error
#:time elapsed-time
#:update-hz update-hz)))
(lambda ()