SDL_PenAxis(3type)
β¨ SDL_PenAxis β¨
okay bestie, welcome to the SDL_PenAxis(3type) page β it lives in the SDL3 DATATYPES section of the manual, and it's literally just the vibe check for every axis a pen can report. short page, big slay π
πΈ NAME πΈ
SDL_PenAxis β the pen axis indices, i.e. the official list of "which direction/number is this pen talking about" π
π SYNOPSIS π
#include <SDL3/SDL_pen.h>
typedef enum SDL_PenAxis
{
SDL_PEN_AXIS_PRESSURE, /**< Pen pressure. Unidirectional: 0 to 1.0 */
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_AXIS_DISTANCE, /**< Pen distance to drawing surface. Unidirectional: 0.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_COUNT /**< Total known pen axis types in this version of SDL. This number may grow in future releases! */
} SDL_PenAxis;
yes queen, that's the whole enum, no crumbs left behind π«Ά
π¦ DESCRIPTION π¦
So these are the valid values for the axis field in SDL_PenAxisEvent. That's the whole point of this enum, bestie β it's the menu you pick from when a pen event tells you "hey, something moved."
Every single axis is either normalised to 0..1 or it reports a (positive or negative) angle in degrees, and in the angle case 0.0 represents the centre. Like, the middle. The neutral. The main character resting pose. π§
β οΈ Not all pens/backends support all axes β and unsupported axes are always zero. So if your pen isn't giving, it's not being shady, it just literally cannot. zero means "not supported here," no cap.
π converting angles to vectors π
Wanna turn tilt and rotation into vector representation? You use SDL_sinf on the XTILT, YTILT, or ROTATION component, like this:
SDL_sinf(xtilt * SDL_PI_F / 180.0).
that's the exact incantation, character for character, don't improvise β¨
β AVAILABILITY β
This enum has been available since SDL 3.2.0. it's not new-new, but it's not ancient either. iconic behavior. π
π quick reminder that SDL_PEN_AXIS_COUNT is the total known pen axis types in this version of SDL, and this number may grow in future releases β so don't you dare hardcode assumptions around it, fr fr.
and that's the page!! go forth and read your pen axes correctly, bestie π
this has been SDL_PenAxis(3type) from the Simple Directmedia Layer, SDL 3.4.18 β love u, bye πβ¨π¦
π¦ where this page comes from
- fedora 43: SDL3-devel 3.4.18-1.fc43 Β· Zlib AND MIT AND Apache-2.0 AND (Apache-2.0 OR MIT)
- fedora 43: SDL3-devel 3.4.18-1.fc43 Β· Zlib AND MIT AND Apache-2.0 AND (Apache-2.0 OR MIT)
- fedora 44: SDL3-devel 3.4.18-1.fc44 Β· Zlib AND MIT AND Apache-2.0 AND (Apache-2.0 OR MIT)
- fedora 44: SDL3-devel 3.4.18-1.fc44 Β· Zlib AND MIT AND Apache-2.0 AND (Apache-2.0 OR MIT)
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms