GETTOUCHHIT
 
Tests whether any active touch contact is inside a rectangle or circle.

Syntax

Declare Function GetTouchHit ( ByVal x1 As Integer, ByVal y1 As Integer, ByVal x2 As Integer, ByVal y2 As Integer ) As Integer
Declare Function GetTouchHit ( ByVal x As Integer, ByVal y As Integer, ByVal radius As Integer ) As Integer

Usage

hit = GetTouchHit( x1, y1, x2, y2 )
hit = GetTouchHit( x, y, radius )

Parameters

x1, y1, x2, y2
Opposite corners of the rectangle to test.
x, y
The center of the circle to test.
radius
The radius of the circle to test.

Return Value

-1 if one or more active touch contacts are inside the requested area, otherwise 0.

Description

GetTouchHit is a small helper for touch-oriented user interfaces. It checks all currently active touch contacts and reports whether any contact is inside the requested rectangle or circle.

The rectangle overload accepts the corners in either order. The circle overload treats a negative radius as its absolute value.

On platforms without native touch support, the normal mouse fallback applies: a held left mouse button can count as one touch contact.

Dialect Differences

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

  • New to FreeBASIC 1.20.1.
See also