diff options
author | David Thompson <dthompson2@worcester.edu> | 2015-11-12 12:14:38 -0500 |
---|---|---|
committer | David Thompson <dthompson2@worcester.edu> | 2015-11-12 12:14:38 -0500 |
commit | efbd5d797af6ca36a61f225dc02ade47e8dfd175 (patch) | |
tree | 2aa860a534c97c2abadf24ea5dc65f3b4a5c9796 | |
parent | d6113f19673670320f79e880c236c6fcb760dd93 (diff) |
game: Stop the game loop upon SIGINT.
Fixes a long standing annoyance that pressing C-c wouldn't kill the
application.
* sly/game.scm (run-game-loop): Catch SIGINT and call 'stop-game-loop'.
-rw-r--r-- | sly/game.scm | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/sly/game.scm b/sly/game.scm index ef92e90..b114ada 100644 --- a/sly/game.scm +++ b/sly/game.scm @@ -151,6 +151,11 @@ milliseconds of the last iteration of the game loop." (call-with-prompt 'game-loop-prompt (lambda () + ;; Catch SIGINT and kill the loop. + (sigaction SIGINT + (lambda (signum) + (stop-game-loop))) + ;; Let's play! (game-loop (SDL:get-ticks) 0)) (lambda (cont callback) (when (procedure? callback) |