Game Development Reference
In-Depth Information
Detecting single touch input using polling
We can determine the current on-screen position being pointed at (either by the
on-screen cursor or a touch on the screen) by using the s3ePointerGetX and
s3ePointerGetY functions, which will return the current horizontal and vertical
pixel positions being pointed at.
In the case of a touch screen, the current position returned by these functions will be
the last known position pointed at if the user is not currently making an input. The
default value before any touches have been made will be (0,0)—the top-left corner of
the screen.
To determine whether an input is currently in progress, we can use the function
s3ePointerGetState , which takes an element from the s3ePointerButton
enumeration and returns a value from the s3ePointerState enumeration. The
following table shows the values that make up the s3ePointerButton enumeration:
Value
Description
S3E_POINTER_BUTTON_SELECT
Returns the status of either the left mouse
button or a touch screen tap.
S3E_POINTER_BUTTON_LEFTMOUSE
An alternative name for S3E_POINTER_
BUTTON_SELECT , which you may prefer to
use if detecting other mouse buttons as well.
S3E_POINTER_BUTTON_RIGHTMOUSE
Returns the status of the right mouse button.
S3E_POINTER_BUTTON_MIDDLEMOUSE
Returns the status of the middle mouse
button.
S3E_POINTER_BUTTON_
MOUSEWHEELUP
Used to determine if the user has scrolled the
mouse wheel upwards.
S3E_POINTER_BUTTON_
MOUSEWHEELDOWN
Used to determine if the user has scrolled the
mouse wheel downwards.
The next table shows the members of the s3ePointerState enumeration, which
indicate the current status of the requested pointer button or touch screen tap:
Value
Description
S3E_POINTER_STATE_UP
The button is not depressed or contact is not
currently made with the touch screen.
S3E_POINTER_STATE_DOWN
The button is being held down or contact has
been made with the touch screen.
Search WWH ::




Custom Search