clarified stop conditions for big-bang
svn: r13867
This commit is contained in:
parent
ba925a22d9
commit
3112bab011
|
@ -91,10 +91,13 @@ The simplest kind of animated @tech{world} program is a time-based
|
||||||
@defproc[(run-simulation [create-image (-> natural-number/c scene)])
|
@defproc[(run-simulation [create-image (-> natural-number/c scene)])
|
||||||
true]{
|
true]{
|
||||||
|
|
||||||
opens a canvas and starts a clock that tick 28 times per second.
|
opens a canvas and starts a clock that tick 28 times per second. Every
|
||||||
Every time the clock ticks, DrScheme applies
|
time the clock ticks, DrScheme applies @scheme[create-image] to the
|
||||||
@scheme[create-image] to the number of ticks passed since this function
|
number of ticks passed since this function call. The results of these
|
||||||
call. The results of these applications are displayed in the canvas.
|
function calls are displayed in the canvas. The simulation runs until you
|
||||||
|
click the @tt{Stop} button in DrScheme or close the window. At that
|
||||||
|
point, @scheme[run-simulation] returns the number of ticks that have
|
||||||
|
passed.
|
||||||
}
|
}
|
||||||
|
|
||||||
Example:
|
Example:
|
||||||
|
@ -183,7 +186,11 @@ The design of a world program demands that you come up with a data
|
||||||
itself as a scene; when the program must shut down; where to register the
|
itself as a scene; when the program must shut down; where to register the
|
||||||
world with a universe; and whether to record the stream of events. A world
|
world with a universe; and whether to record the stream of events. A world
|
||||||
specification may not contain more than one @scheme[on-tick],
|
specification may not contain more than one @scheme[on-tick],
|
||||||
@scheme[on-draw], or @scheme[register] clause.}
|
@scheme[on-draw], or @scheme[register] clause. A @scheme[big-bang]
|
||||||
|
expression returns the last world when the stop condition is satisfied
|
||||||
|
(see below) or when the programmer clicks on the @tt{Stop} button or
|
||||||
|
closes the canvas.
|
||||||
|
}
|
||||||
|
|
||||||
@itemize[
|
@itemize[
|
||||||
|
|
||||||
|
@ -330,7 +337,8 @@ All @tech{MouseEvent}s are represented via symbols:
|
||||||
drawn. If this call produces @scheme[true], the world program is shut
|
drawn. If this call produces @scheme[true], the world program is shut
|
||||||
down. Specifically, the clock is stopped; no more
|
down. Specifically, the clock is stopped; no more
|
||||||
tick events, @tech{KeyEvent}s, or @tech{MouseEvent}s are forwarded to
|
tick events, @tech{KeyEvent}s, or @tech{MouseEvent}s are forwarded to
|
||||||
the respective handlers.
|
the respective handlers. The @scheme[big-bang] expression returns this
|
||||||
|
last world.
|
||||||
}}
|
}}
|
||||||
|
|
||||||
@item{
|
@item{
|
||||||
|
|
Loading…
Reference in New Issue
Block a user