SDL2::touch - SDL Touch Event Handling
use SDL2 qw[:touch];
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.
:touch
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.
0
Returns the number of registered touch devices.
SDL_GetTouchDevice( ... )
Get the touch ID with the given index.
Expected parameters include:
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_GetError( )
SDL_GetTouchDeviceType( ... )
Get the type of the given touch device.
touchID
Returns a SDL_TouchDeviceType.
SDL_TouchDeviceType
SDL_GetNumTouchFingers( ... )
Get the number of active fingers for a given 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.
Returns a pointer to the SDL2::Finger object or undef if no object at the given ID and index could be found.
undef
These values may be imported by name or with the given tag.
SDL_TouchID
Signed 64-bit integer.
SDL_FingerID
Enumeration which may be imported with the :touchDeviceType tag.
:touchDeviceType
SDL_TOUCH_DEVICE_INVALID
SDL_TOUCH_DEVICE_DIRECT
SDL_TOUCH_DEVICE_INDIRECT_ABSOLUTE
SDL_TOUCH_DEVICE_INDIRECT_RELATIVE
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.
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.
Sanko Robinson <sanko@cpan.org>
To install SDL2::FFI, copy and paste the appropriate command in to your terminal.
cpanm
cpanm SDL2::FFI
CPAN shell
perl -MCPAN -e shell install SDL2::FFI
For more information on module installation, please visit the detailed CPAN module installation guide.