changed world.ss interface (docs) to accommodate stepper
svn: r1579
This commit is contained in:
parent
6b33960bb4
commit
ea35acdfc7
|
@ -12,19 +12,35 @@ students to simulate a small world of animated drawings and games:
|
||||||
and makes w the first world
|
and makes w the first world
|
||||||
|
|
||||||
<li><code>on-tick-event : (World -> World) -> true</code><br>
|
<li><code>on-tick-event : (World -> World) -> true</code><br>
|
||||||
<code>(on-tick-event tock)</code>
|
<code>(on-tick-event tock)</code> means that DrScheme must call <code>tock</code>
|
||||||
calls tock on the current world for every clock tick;
|
on the current world every time the clock ticks; it uses the result as the next world
|
||||||
the result is the next world
|
|
||||||
|
|
||||||
<li><code>on-key-event : (KeyEvent World -> World) -> true</code><br>
|
<li><code>on-key-event : (KeyEvent World -> World) -> true</code><br>
|
||||||
<code>(on-key-event react)</code>
|
<code>(on-key-event change)</code> means that DrScheme must call
|
||||||
calls react on every keystroke event,
|
<code>change</code> on the current world for every keystroke event; it uses
|
||||||
with a char or a symbol representing the keystroke,
|
the result as the next world
|
||||||
and the current world; the result is the next world
|
|
||||||
|
<pre>
|
||||||
|
<code>
|
||||||
|
;; A KeyEvent is one of:
|
||||||
|
;; -- Char (char?)
|
||||||
|
;; -- Symbol (symbol?)
|
||||||
|
</code>
|
||||||
|
When the Keyevent is a char, the programmer (user of the computer) has hit an
|
||||||
|
alphanumeric key. Symbols such as <code>'left</code>, <code>'right</code>,
|
||||||
|
<code>'up</code>, <code>'down</code>, <code>'release</code> denote arrow keys
|
||||||
|
or the events of releasing a key on the keypad.
|
||||||
|
</pre>
|
||||||
|
|
||||||
|
<li><code>on-redraw : (World -> Image) -> true</code><br>
|
||||||
|
<code>(on-tick-event world->image)</code> means that DrScheme
|
||||||
|
calls <code>world->image</code> whenever the canvas must be redrawn; the
|
||||||
|
result is displayed in the teachpack's canvas
|
||||||
|
|
||||||
<li><code>end-of-time : -> World</code><br>
|
<li><code>end-of-time : -> World</code><br>
|
||||||
<code>(end-of-time)</code>
|
When DrScheme evaluates <code>(end-of-time)</code>, it stops the clock; no
|
||||||
stops the clock.
|
further tick events, key events, or redraw events take place until the world
|
||||||
|
is created again.
|
||||||
</menu></p>
|
</menu></p>
|
||||||
|
|
||||||
<p>The rest are functions for creating scenes:
|
<p>The rest are functions for creating scenes:
|
||||||
|
@ -47,17 +63,7 @@ students to simulate a small world of animated drawings and games:
|
||||||
shows the list of images in loi, time-delayed
|
shows the list of images in loi, time-delayed
|
||||||
</menu></p>
|
</menu></p>
|
||||||
|
|
||||||
<p>Finally, the teachpack also adds some one new form of syntax to the
|
<p>Finally, the teachpack provides all the functions that image.ss provides. </p>
|
||||||
language:
|
|
||||||
<menu>
|
|
||||||
<li><code>
|
|
||||||
(<b>update</b> <expression> <b>produce</b> <expression>)</code><br>
|
|
||||||
update the canvas of the world with the first expression; the result
|
|
||||||
is the value of the second expression.
|
|
||||||
</menu>
|
|
||||||
Both update and produce are new keywords. </p>
|
|
||||||
|
|
||||||
<p>The teachpack provides all the functions that image.ss provides. </p>
|
|
||||||
|
|
||||||
{(include "foot.tinc")}
|
{(include "foot.tinc")}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user