beetlebug▾
/

ztk::game step

Runs a count of steps now, and then the draw script once.

ztk::game step ?COUNT?

Description

Runs COUNT steps (1 by default, from 0 to 100,000), also while the loop is paused or stopped. Each step reads the actions as a step of the loop does. A test uses it to step a game by an exact count.

Returns

An empty string.

Examples

% set ::n 0
> proc tick {dt} { incr ::n }
> ztk::game loop -update tick
> ztk::game pause
> ztk::game step 10
> set ::n
10

Errors

% ztk::game step -1
expected a count from 0 to 100000 but got "-1"
-errorcode ZTK GAME STEP

% ztk::game step x
expected integer but got "x"
-errorcode TCL VALUE NUMBER

Facts

Capability
None.
Tcl release
Tcl 9.1 and 8.6.
Since
ztk 1.0.0-beta.7