From efbd5d797af6ca36a61f225dc02ade47e8dfd175 Mon Sep 17 00:00:00 2001 From: David Thompson Date: Thu, 12 Nov 2015 12:14:38 -0500 Subject: 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'. --- sly/game.scm | 5 +++++ 1 file changed, 5 insertions(+) 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) -- cgit v1.2.3