diff options
-rw-r--r-- | sly/game.scm | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/sly/game.scm b/sly/game.scm index 615f934..38d230e 100644 --- a/sly/game.scm +++ b/sly/game.scm @@ -40,6 +40,7 @@ draw-hook after-game-loop-error-hook game-started? + on-start run-game-loop stop-game-loop)) @@ -56,6 +57,16 @@ (define-signal game-started? (hook->signal game-start-hook #f (lambda () #t))) +(define-syntax on-start + (syntax-rules () + "Create a signal that evaluates EXP once the game loop has started. +If INIT is specified, the signal uses the result of this expression as +its initial value, otherwise #f is the initial value." + ((_ exp) + (signal-if game-started? exp #f)) + ((_ exp init) + (signal-if game-started? exp init)))) + ;;; ;;; Game Loop |