NAME

SDL2::touch - SDL Touch Event Handling

SYNOPSIS

use SDL2 qw[:touch];

DESCRIPTION

SDL2::touch provides functions and defined values that allow for handling simple touch events. These functions may be imported by name or with the :touch tag.

Functions

These may be imported by name or with the :touch tag.

SDL_GetNumTouchDevices( )

Get the number of registered touch devices.

On some platforms SDL first sees the touch device if it was actually used. Therefore SDL_GetNumTouchDevices( ) may return 0 although devices are available. After using all devices at least once the number will be correct.

Returns the number of registered touch devices.

SDL_GetTouchDevice( ... )

Get the touch ID with the given index.

Expected parameters include:

index - the touch device index

Returns the touch ID with the given index on success or 0 if the index is invalid; call SDL_GetError( ) for more information.

SDL_GetTouchDeviceType( ... )

Get the type of the given touch device.

Expected parameters include:

touchID - the touch ID to query

Returns a SDL_TouchDeviceType.

SDL_GetNumTouchFingers( ... )

Get the number of active fingers for a given touch device.

Expected parameters include:

touchID - the ID of a touch device

Returns the number of active fingers for a given touch device on success or 0 on failure; call SDL_GetError( ) for more information.

SDL_GetTouchFinger( ... )

Get the finger object for specified touch device ID and finger index.

The returned resource is owned by SDL and should not be deallocated.

Expected parameters include:

touchID - the ID of the requested touch device
index - the index of the requested finger

Returns a pointer to the SDL2::Finger object or undef if no object at the given ID and index could be found.

Defined Types, Enumerations, and Values

These values may be imported by name or with the given tag.

SDL_TouchID

Signed 64-bit integer.

SDL_FingerID

Signed 64-bit integer.

SDL_TouchDeviceType

Enumeration which may be imported with the :touchDeviceType tag.

SDL_TOUCH_DEVICE_INVALID
SDL_TOUCH_DEVICE_DIRECT - touch screen with window-relative coordinates
SDL_TOUCH_DEVICE_INDIRECT_ABSOLUTE - trackpad with absolute device coordinates
SDL_TOUCH_DEVICE_INDIRECT_RELATIVE - trackpad with screen cursor-relative coordinates

SDL_TOUCH_MOUSEID

Used as the device ID for mouse events simulated with touch input.

SDL_MOUSE_TOUCHID

Used as the SDL_TouchID for touch events simulated with mouse input.

LICENSE

Copyright (C) Sanko Robinson.

This library is free software; you can redistribute it and/or modify it under the terms found in the Artistic License 2. Other copyrights, terms, and conditions may apply to data transmitted through this module.

AUTHOR

Sanko Robinson <sanko@cpan.org>