GETTOUCH
 
Gets position and identifier information for an active touch contact.

Syntax

Declare Function GetTouch ( ByVal index As Integer, ByRef x As Integer, ByRef y As Integer, ByRef id As Integer = 0 ) As Integer

Usage

result = GetTouch( index, x, y [, id] )

Parameters

index
The zero-based touch contact index to query.
x
Receives the touch x coordinate.
y
Receives the touch y coordinate.
id
Receives the backend touch identifier, if available.

Return Value

0 on success, or a non-zero runtime error value if the requested contact is not available.

Description

GetTouch retrieves one active touch contact from the current graphics screen. index is zero-based and should be less than the value returned by GetTouchCount.

x and y are returned in logical graphics coordinates relative to the upper-left corner of the graphics screen. They are not affected by View or Window.

id is intended to identify the same physical contact while it remains active. Some backends provide a native contact id. The mouse fallback uses id 0.

If the requested contact is not available, x, y and id are set to -1 when those arguments are provided.

Dialect Differences

  • Not available in the -lang qb dialect unless referenced with the alias __GetTouch.
Differences from QB

  • New to FreeBASIC 1.20.1.
See also