SDL_PenAxisEvent(3type)

πŸ’… SDL_PenAxisEvent (3type) ✨

okay bestie, welcome to the SDL3 DATATYPES corner of the manual β€” this one's about the pressure-sensitive pen pressure / angle event structure, aka the <hotpink>event.paxis.*</hotpink> vibe. it's giving stylus main character energy πŸ–ŠοΈπŸ’–


🌸 NAME 🌸

SDL_PenAxisEvent β€” the pressure-sensitive pen pressure / angle event structure, also known as <purple>event.paxis.*</purple>. no cap, that's literally the whole name section, we move πŸ’…


✨ SYNOPSIS ✨

so first you gotta include the header, periodt:

#include <SDL3/SDL_events.h>

and here's the struct itself, character for character, don't touch a thing:

typedef struct SDL_PenAxisEvent
{
    SDL_EventType type;     /**< SDL_EVENT_PEN_AXIS */
    Uint32 reserved;
    Uint64 timestamp;       /**< In nanoseconds, populated using SDL_GetTicksNS() */
    SDL_WindowID windowID;  /**< The window with pen focus, if any */
    SDL_PenID which;        /**< The pen instance id */
    SDL_PenInputFlags pen_state;   /**< Complete pen input state at time of event */
    float x;                /**< X coordinate, relative to window */
    float y;                /**< Y coordinate, relative to window */
    SDL_PenAxis axis;       /**< Axis that has changed */
    float value;            /**< New value of axis */
    SDL_PenDeviceType device_type; /**< the device type of the pen, if known (added in 3.4.18). */
} SDL_PenAxisEvent;

let's break the fields down bc they're all kinda iconic in their own way 🫢

  • type β€” it's an SDL_EventType, and for this one it's <rainbow>SDL_EVENT_PEN_AXIS</rainbow> πŸ‘‘
  • reserved β€” a Uint32. it's reserved. mind your business, bestie πŸ™ˆ
  • timestamp β€” a Uint64, measured in nanoseconds, and it gets populated using SDL_GetTicksNS() ⏱️
  • windowID β€” an SDL_WindowID: the window with pen focus, if any (emphasis on if any, sometimes there's nobody home 😭)
  • which β€” an SDL_PenID: the pen instance id, so you know which pen is which πŸ–ŠοΈ
  • pen_state β€” an SDL_PenInputFlags: the complete pen input state at the time of the event. complete. the whole picture. slay πŸ’…
  • x β€” a float: X coordinate, relative to window πŸ“
  • y β€” a float: Y coordinate, relative to window πŸ“
  • axis β€” an SDL_PenAxis: the axis that has changed 🎯
  • value β€” a float: the new value of that axis ✨
  • device_type β€” an SDL_PenDeviceType: the device type of the pen, if known (and heads up, this one was added in 3.4.18) πŸŽ€

πŸ’œ DESCRIPTION πŸ’œ

so the thing about this one, bestie, and it's lowkey important:

You might get some of these events even if the pen isn't touching the tablet.

like. it's not even touching it. and you're still getting events. the pen is just hovering there, being mysterious, doing its own thing πŸ¦‹ iykyk.


🌈 AVAILABILITY 🌈

this struct has been available since SDL 3.2.0. so if you're on anything older... no it isn't, sorry babe πŸ’€


okay that's the whole page, you ate it up fr fr πŸ“

this was brought to you by Simple Directmedia Layer, version SDL 3.4.18 β€” the <cyan>SDL_PenAxisEvent(3type)</cyan> page, straight from the SDL3 DATATYPES section. mwah, go draw something cute with your stylus πŸ’–βœ¨πŸŽ€

πŸ“¦ where this page comes from