diff options
-rw-r--r-- | chickadee.scm | 4 | ||||
-rw-r--r-- | chickadee/game-loop.scm | 1 | ||||
-rw-r--r-- | doc/api.texi | 5 |
3 files changed, 7 insertions, 3 deletions
diff --git a/chickadee.scm b/chickadee.scm index e4afb13..aec8eef 100644 --- a/chickadee.scm +++ b/chickadee.scm @@ -410,8 +410,8 @@ border is disabled, otherwise it is enabled.") (gl-enable (version-3-2 texture-cube-map-seamless)) (sdl2:load-game-controller-mappings! (scope-datadir "gamecontrollerdb.txt")) - (load) - (run-game* #:update update-sdl + (run-game* #:init load + #:update update-sdl #:render render-sdl-opengl #:error (and error on-error) #:time elapsed-time diff --git a/chickadee/game-loop.scm b/chickadee/game-loop.scm index 1d0c679..027d7af 100644 --- a/chickadee/game-loop.scm +++ b/chickadee/game-loop.scm @@ -65,6 +65,7 @@ (sigaction SIGINT (lambda (signum) (abort-game))) + (init) ;; A simple analogy is that we are filling up a bucket ;; with water. When the bucket fills up to a marked ;; line, we dump it out. Our water is time, and each diff --git a/doc/api.texi b/doc/api.texi index 3946ecd..63b3d9d 100644 --- a/doc/api.texi +++ b/doc/api.texi @@ -332,7 +332,7 @@ make a terminal roguelike game instead? Chickadee doesn't come with a terminal rendering engine, but the developer could write one without having to write their own core game loop. -@deffn {Procedure} run-game* [#:update] [#:render] [#:time] [#:error] @ +@deffn {Procedure} run-game* [#:init] [#:update] [#:render] [#:time] [#:error] @ [#:update-hz 60] Start the game loop. This procedure will not return until @@ -343,6 +343,9 @@ to operate: @itemize @item +@var{init}: Called just before game loop is started. Use it to +perform game initialization. +@item @var{update}: Called @var{update-hz} times per second to advance the game simulation. This procedure is called with a single argument: The amount of time that has passed since the last update, in milliseconds. |