SDL pen event handling.
More...
SDL provides an API for pressure-sensitive pen (stylus and/or eraser) handling, e.g., for input and drawing tablets or suitably equipped mobile / tablet devices.
To get started with pens, simply handle SDL_EVENT_PEN_* events. When a pen starts providing input, SDL will assign it a unique PenID, which will remain for the life of the process, as long as the pen stays connected.
Pens may provide more than simple touch input; they might have other axes, such as pressure, tilt, rotation, etc.
◆ PenAxis
These are the valid values for the axis
field in PenAxisEvent. All axes are either normalised to 0..1 or report a (positive or negative) angle in degrees, with 0.0 representing the centre. Not all pens/backends support all axes: unsupported axes are always zero.
To convert angles for tilt and rotation into vector representation, use sin on the XTILT, YTILT, or ROTATION component, for example:
sin(xtilt * PI_F / 180.0)
.
- Since
- This enum is available since SDL 3.2.0.
◆ PenID
Zero is used to signify an invalid/null device.
These show up in pen events when SDL sees input from them. They remain consistent as long as SDL can recognize a tool to be the same pen; but if a pen physically leaves the area and returns, it might get a new ID.
- Since
- This datatype is available since SDL 3.2.0.
◆ PenInputFlags
- Since
- This datatype is available since SDL 3.2.0.
◆ PEN_AXIS_COUNT
constexpr PenAxis SDL::PEN_AXIS_COUNT = SDL_PEN_AXIS_COUNT |
|
constexpr |
This number may grow in future releases!
◆ PEN_AXIS_PRESSURE
constexpr PenAxis SDL::PEN_AXIS_PRESSURE |
|
constexpr |
◆ PEN_AXIS_ROTATION
constexpr PenAxis SDL::PEN_AXIS_ROTATION = SDL_PEN_AXIS_ROTATION |
|
constexpr |
Bidirectional: -180 to 179.9 (clockwise, 0 is facing up, -180.0 is facing down).
◆ PEN_AXIS_TANGENTIAL_PRESSURE
constexpr PenAxis SDL::PEN_AXIS_TANGENTIAL_PRESSURE |
|
constexpr |
Initial value:=
SDL_PEN_AXIS_TANGENTIAL_PRESSURE
◆ PEN_INPUT_BUTTON_1
◆ PEN_INPUT_BUTTON_2
◆ PEN_INPUT_BUTTON_3
◆ PEN_INPUT_BUTTON_4
◆ PEN_INPUT_BUTTON_5
◆ PEN_INPUT_DOWN
◆ PEN_INPUT_ERASER_TIP
Initial value:=
SDL_PEN_INPUT_ERASER_TIP
◆ PEN_MOUSEID
constexpr MouseID SDL::PEN_MOUSEID = SDL_PEN_MOUSEID |
|
constexpr |
- Since
- This macro is available since SDL 3.2.0.
◆ PEN_TOUCHID
constexpr TouchID SDL::PEN_TOUCHID = SDL_PEN_TOUCHID |
|
constexpr |
- Since
- This macro is available since SDL 3.2.0.