Petit Computer Wiki
Petit Computer Wiki
Advertisement

Together, the system variables TCHX, TCHY, TCHST and TCHTIME (all read-only integers) indicate activity on the touchscreen.

When the stylus is detected on the touchscreen, TCHX and TCHY are set to the location of the touch, TCHST is set to 1, and TCHTIME starts counting. As long as the stylus stays in contact with the screen, TCHX and TCHY will follow the contact point and TCHTIME will keep increasing. As soon as the stylus is removed, TCHST is set to 0, and TCHTIME is set to 0 and will stop. TCHX and TCHY will retain their last values, so even when the stylus is up, you can read the last location it was detected.

TCHX appears to have a range of 0 to 255 inclusive, and TCHY appears to have a range of 0 to 191 inclusive. TCHTIME appears to use frames as the unit of time. Note that it may always not be possible to reach the most extreme values of the TCHX or TCHY range. For example, the effective range of TCHX may be from 2 to 254 on one system.

Advertisement