SDL_STANDARD_GRAVITY(3)
β¨ SDL_STANDARD_GRAVITY β¨
okay bestie, welcome to the SDL3 FUNCTIONS corner of the manual π this one's a lil macro that literally just holds a number, but it's a number you're gonna want, so let's go π«Ά
π NAME π
SDL_STANDARD_GRAVITY β a constant that represents standard gravity, made specifically for accelerometer sensors. yes it's giving "physics class flashback" but make it C π
πΈ SYNOPSIS πΈ
#include <SDL3/SDL_sensor.h>
#define SDL_STANDARD_GRAVITY 9.80665f
that's it. that's the whole vibe. one include, one define, zero drama β¨
π¦ DESCRIPTION π¦
so here's the tea β your accelerometer reports the current acceleration in SI meters per second squared. and like β plot twist β that measurement includes the force of gravity. so a device that's just chillin', sitting at rest, not moving, living its best life? it'll read an value of SDL_STANDARD_GRAVITY away from the center of the earth π
and the way that shows up is as a positive Y value. iconic. gravity said "up is positive on Y, you're welcome" π
fr fr, if your device is at rest and you're getting something wildly different from SDL_STANDARD_GRAVITY on Y, something's up β that's your vibe check π
π AVAILABILITY π
this macro has been around since SDL 3.2.0. so if you're on anything older, no it hasn't π
Simple Directmedia Layer energy, SDL 3.4.18 version, and that's a wrap bestie π slay responsibly, go measure some gravity, mwah πβ¨π¦
π¦ 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