SDL_PenInputFlags(3type)

πŸ’– SDL_PenInputFlags πŸ’–

okay bestie, gather round, because this is the SDL_PenInputFlags page from the SDL3 datatypes manual and it's genuinely such a cute little type. no cap.


✨ NAME ✨

SDL_PenInputFlags β€” pen input flags, as reported by various pen events' pen_state field. that's it, that's the whole vibe. it's the little bundle of bits that tells you what your pen is doing rn πŸ–ŠοΈβœ¨


🌸 SYNOPSIS 🌸

first things first, you gotta pull in the header:

#include <SDL3/SDL_pen.h>

and here's the type itself, she's just a Uint32 underneath, lowkey iconic:

typedef Uint32 SDL_PenInputFlags;

then the actual flags, and bestie these are the whole point, look at them:

#define SDL_PEN_INPUT_DOWN         (1u << 0)  /**< pen is pressed down */
#define SDL_PEN_INPUT_BUTTON_1     (1u << 1)  /**< button 1 is pressed */
#define SDL_PEN_INPUT_BUTTON_2     (1u << 2)  /**< button 2 is pressed */
#define SDL_PEN_INPUT_BUTTON_3     (1u << 3)  /**< button 3 is pressed */
#define SDL_PEN_INPUT_BUTTON_4     (1u << 4)  /**< button 4 is pressed */
#define SDL_PEN_INPUT_BUTTON_5     (1u << 5)  /**< button 5 is pressed */
#define SDL_PEN_INPUT_ERASER_TIP   (1u << 30) /**< eraser tip is used */
#define SDL_PEN_INPUT_IN_PROXIMITY (1u << 31) /**< pen is in proximity (since SDL 3.4.0) */

let's walk through the squad, one by one, fr fr:

  • SDL_PEN_INPUT_DOWN β€” (1u << 0) β€” pen is pressed down. the pen is touching, she's committed πŸ’…
  • SDL_PEN_INPUT_BUTTON_1 β€” (1u << 1) β€” button 1 is pressed.
  • SDL_PEN_INPUT_BUTTON_2 β€” (1u << 2) β€” button 2 is pressed.
  • SDL_PEN_INPUT_BUTTON_3 β€” (1u << 3) β€” button 3 is pressed.
  • SDL_PEN_INPUT_BUTTON_4 β€” (1u << 4) β€” button 4 is pressed.
  • SDL_PEN_INPUT_BUTTON_5 β€” (1u << 5) β€” button 5 is pressed. yes bestie, five whole buttons, the pen said "more" 🫢
  • SDL_PEN_INPUT_ERASER_TIP β€” (1u << 30) β€” eraser tip is used. flipped her over, she's erasing now 😭
  • SDL_PEN_INPUT_IN_PROXIMITY β€” (1u << 31) β€” pen is in proximity (since SDL 3.4.0). she's hovering, not touching, just near you. main character energy honestly 🌈

notice how the bit positions are all over the place? 0 through 5 up front, then a jump way out to 30 and 31. that's not a typo, that's just how she's built. do not "fix" it. πŸ™ˆ

these flags show up in the pen_state field of various pen events. that's the field you're reading, that's where the tea lives. πŸ“

πŸ¦‹ AVAILABILITY πŸ¦‹

This datatype is available since SDL 3.2.0. (and SDL_PEN_INPUT_IN_PROXIMITY specifically? that one's newer, SDL 3.4.0, as noted up there in the define.) ✨


and that's the whole page, bestie, you ate it. this little cutie came to you from Simple Directmedia Layer, SDL 3.4.18, and she's the SDL_PenInputFlags(3type) page. mwah, go write something iconic with it πŸ‘‘πŸ’–

πŸ“¦ where this page comes from