summaryrefslogtreecommitdiff
path: root/manuals/chickadee/The-Game-Loop.html
diff options
context:
space:
mode:
Diffstat (limited to 'manuals/chickadee/The-Game-Loop.html')
-rw-r--r--manuals/chickadee/The-Game-Loop.html23
1 files changed, 19 insertions, 4 deletions
diff --git a/manuals/chickadee/The-Game-Loop.html b/manuals/chickadee/The-Game-Loop.html
index 1cb6e48..d18ad0d 100644
--- a/manuals/chickadee/The-Game-Loop.html
+++ b/manuals/chickadee/The-Game-Loop.html
@@ -1,6 +1,6 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
-<!-- Copyright (C) 2017-2020 David Thompson davet@gnu.org
+<!-- Copyright (C) 2017-2021 David Thompson davet@gnu.org
Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.3
@@ -85,7 +85,7 @@ ul.no-bullet {list-style: none}
Next: <a href="Input-Devices.html" accesskey="n" rel="next">Input Devices</a>, Up: <a href="Kernel.html" accesskey="u" rel="up">Kernel</a> &nbsp; [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Index.html" title="Index" rel="index">Index</a>]</p>
</div>
<hr>
-<span id="The-Game-Loop-1"></span><h4 class="subsection">2.1.1 The Game Loop</h4>
+<span id="The-Game-Loop-1"></span><h4 class="subsection">5.1.1 The Game Loop</h4>
<p>At the very core of Chickadee there is an event loop. This loop, or
&ldquo;kernel&rdquo;, is responsible for ensuring that the game is updated at
@@ -98,6 +98,9 @@ styles of game loops. The appropriately named <code>run-game</code> and
<code>abort-game</code> procedures are the entry and exit points to the
Chickadee game loop.
</p>
+<p>If you are using <code>chickadee play</code> to launch your game, then
+calling <code>run-game</code> is already taken care of for you.
+</p>
<dl>
<dt id="index-run_002dgame">Procedure: <strong>run-game</strong> <em>[#:window-title &quot;Chickadee!&quot;] [#:window-width 640] [#:window-height 480] [#:window-fullscreen? <code>#f</code>] [#:window-resizable? <code>#f</code>] [#:update-hz 60] [#:load] [#:update] [#:draw] [#:quit] [#:key-press] [#:key-release] [#:text-input] [#:mouse-press] [#:mouse-release] [#:mouse-move] [#:controller-add] [#:controller-remove] [#:controller-press] [#:controller-release] [#:controller-move] [#:error]</em></dt>
<dd>
@@ -198,6 +201,16 @@ mouse was moved.
</li></ol>
+</li><li> <var>mouse-wheel</var>: Called with two arguments when the mouse wheel is
+scrolled:
+
+<ol>
+<li> <var>x</var>: The scroll amount along the X axis.
+
+</li><li> <var>y</var>: The scroll amount along the Y axis.
+
+</li></ol>
+
</li><li> <var>controller-add</var>: Called with a single argument, an SDL game
controller object, when a game controller is connected.
@@ -304,7 +317,7 @@ terminal rendering engine, but the developer could write one without
having to write their own core game loop.
</p>
<dl>
-<dt id="index-run_002dgame_002a">Procedure: <strong>run-game*</strong> <em>[#:update] [#:render] [#:time] [#:error] [#:update-hz 60]</em></dt>
+<dt id="index-run_002dgame_002a">Procedure: <strong>run-game*</strong> <em>[#:init] [#:update] [#:render] [#:time] [#:error] [#:update-hz 60]</em></dt>
<dd>
<p>Start the game loop. This procedure will not return until
<code>abort-game</code> is called.
@@ -313,7 +326,9 @@ having to write their own core game loop.
to operate:
</p>
<ul>
-<li> <var>update</var>: Called <var>update-hz</var> times per second to advance the
+<li> <var>init</var>: Called just before game loop is started. Use it to
+perform game initialization.
+</li><li> <var>update</var>: Called <var>update-hz</var> 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.
</li><li> <var>render</var>: Called each iteration of the loop to render the game to