Module pen
Available on crate feature
dep_sdl3
only.Expand description
SDL pen event handling.
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 SDL_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.
Structs§
- SDL_
PenAxis - Pen axis indices.
Constants§
- SDL_
PEN_ AXIS_ COUNT - Total known pen axis types in this version of SDL. This number may grow in future releases!
- SDL_
PEN_ AXIS_ DISTANCE - Pen distance to drawing surface. Unidirectional: 0.0 to 1.0
- SDL_
PEN_ AXIS_ PRESSURE - Pen pressure. Unidirectional: 0 to 1.0
- SDL_
PEN_ AXIS_ ROTATION - Pen barrel rotation. Bidirectional: -180 to 179.9 (clockwise, 0 is facing up, -180.0 is facing down).
- SDL_
PEN_ AXIS_ SLIDER - Pen finger wheel or slider (e.g., Airbrush Pen). Unidirectional: 0 to 1.0
- SDL_
PEN_ AXIS_ TANGENTIAL_ PRESSURE - Pressure from squeezing the pen (“barrel pressure”).
- SDL_
PEN_ AXIS_ XTILT - Pen horizontal tilt angle. Bidirectional: -90.0 to 90.0 (left-to-right).
- SDL_
PEN_ AXIS_ YTILT - Pen vertical tilt angle. Bidirectional: -90.0 to 90.0 (top-to-down).
- SDL_
PEN_ INPUT_ BUTTON_ 1 - button 1 is pressed
- SDL_
PEN_ INPUT_ BUTTON_ 2 - button 2 is pressed
- SDL_
PEN_ INPUT_ BUTTON_ 3 - button 3 is pressed
- SDL_
PEN_ INPUT_ BUTTON_ 4 - button 4 is pressed
- SDL_
PEN_ INPUT_ BUTTON_ 5 - button 5 is pressed
- SDL_
PEN_ INPUT_ DOWN - pen is pressed down
- SDL_
PEN_ INPUT_ ERASER_ TIP - eraser tip is used
- SDL_
PEN_ MOUSEID - The
SDL_MouseID
for mouse events simulated with pen input. - SDL_
PEN_ TOUCHID - The
SDL_TouchID
for touch events simulated with pen input.
Type Aliases§
- SDL_
PenID - SDL pen instance IDs.
- SDL_
PenInput Flags - Pen input flags, as reported by various pen events’
pen_state
field.