ztk::game axis
Names an axis from -1 to 1, or gives its value in this step.
ztk::game axis NAME
ztk::game axis NAME ?-keys {NEGATIVE POSITIVE}? ?-drag x|y? ?-pad AXIS? ?-tilt x|y?
Description
-keys is a list of two lists of keys: the keys that give -1 and the keys that give 1. -drag x or -drag y adds the drag of the first pointer or finger from the start of its press, where 48 logical pixels give 1. The sum stays from -1 to 1. -pad and -tilt are kept with no effect in this stage: controllers come in stage 3, and tilt needs the capability sensors.
With NAME alone, gives the value at the start of the current step.
Returns
An empty string, or a number from -1 to 1.
Examples
% ztk::game axis move -keys {Left Right}
> event generate . <KeyPress-Left>
> ztk::game step
> ztk::game axis move
-1.0
Errors
% ztk::game axis move -drag z
bad drag "z": must be x or y
-errorcode ZTK GAME DRAG z
% ztk::game axis nosuch
no axis "nosuch"
-errorcode ZTK GAME AXIS nosuch
Facts
- Capability
- None.
- Tcl release
- Tcl 9.1 and 8.6.
- Since
- ztk 1.0.0-beta.7