SDL_PowerState(3type)
π SDL_PowerState π
ok so bestie, welcome to SDL_PowerState β she's a lil enum from the SDL3 datatypes crew and she's literally the whole vibe check on your system's power supply. πβ¨
β¨ NAME β¨
SDL_PowerState β the basic state for the system's power supply. that's it, that's the girl. π
πΈ SYNOPSIS πΈ
#include <SDL3/SDL_power.h>
typedef enum SDL_PowerState
{
SDL_POWERSTATE_ERROR = -1, /**< error determining power status */
SDL_POWERSTATE_UNKNOWN, /**< cannot determine power status */
SDL_POWERSTATE_ON_BATTERY, /**< Not plugged in, running on the battery */
SDL_POWERSTATE_NO_BATTERY, /**< Plugged in, no battery available */
SDL_POWERSTATE_CHARGING, /**< Plugged in, charging battery */
SDL_POWERSTATE_CHARGED /**< Plugged in, battery charged */
} SDL_PowerState;
no cap, that's the whole thing. six little states, one very important enum. π«Ά
π DESCRIPTION π
okay so listen β these are the results that get handed back to you by SDL_GetPowerInfo(). that's the function that does the actual snooping on your power supply, and this enum is how it tells you what it found. it's giving "messenger, not the message." π¬
let's meet the girls one by one, fr fr:
SDL_POWERSTATE_ERROR = -1β something went wrong determining power status. the error one. she's negative (literally, she's-1) and she's not happy about it. πSDL_POWERSTATE_UNKNOWNβ cannot determine power status. like, nobody knows. it's a mystery. the info just isn't giving. πSDL_POWERSTATE_ON_BATTERYβ not plugged in, running on the battery. you are free, you are unplugged, you are living on borrowed electrons. π¦SDL_POWERSTATE_NO_BATTERYβ plugged in, no battery available. she's on the wall and there's no battery in the building. iconic, honestly. πSDL_POWERSTATE_CHARGINGβ plugged in, charging battery. the glow-up is in progress. give her a minute. β‘SDL_POWERSTATE_CHARGEDβ plugged in, battery charged. full bars, full main character energy. she ate. π
π AVAILABILITY π
this enum is available since SDL 3.2.0. so if you're on anything older, sorry bestie, she doesn't exist yet. π
heads up, bestie:SDL_POWERSTATE_ERRORis-1, so don't go treating these like unsigned values unless you wanna have a bad time. π
and that's the page!! tysm for reading, go forth and check your power state responsibly. πβ
mwah π β this one's brought to you by Simple Directmedia Layer, sitting pretty at version SDL 3.4.18, and yes she is still SDL_PowerState(3type). periodt. πβ¨
π¦ 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