SDL_GetSensors(3)
π SDL_GetSensors π
okay bestie, welcome to the SDL3 FUNCTIONS corner of the manual, this one's called SDL_GetSensors and it's literally your little headcount for every sensor currently vibing with your machine π
β¨ NAME β¨
SDL_GetSensors β get a list of currently connected sensors. that's it, that's the whole job, and she does it flawlessly π
πΈ SYNOPSIS πΈ
#include <SDL3/SDL_sensor.h>
SDL_SensorID * SDL_GetSensors(int *count);
like. look at her. one include, one function, zero drama π¦
π«Ά FUNCTION PARAMETERS π«Ά
countβ a pointer that gets filled in with the number of sensors returned. and yes, she's chill, this one may beNULLif you don't care about the count. no pressure, no judgement, we love a low-stakes parameter π
π RETURN VALUE π
Returns a 0 terminated array of sensor instance IDs. slay. π
But listen β if things go sideways it returns NULL on failure, and then you gotta call SDL_GetError() for more information, because she will not be telling you what went wrong directly, you have to go ask π
π¨ IMPORTANT BESTIE ALERT π¨ β this array is yours to free with SDL_free() when it is no longer needed. do not just walk away from it. free your girl. she deserves peace. π
β AVAILABILITY β
This function is available since SDL 3.2.0. so if you're on anything older, sorry babe, it's giving "not yet" π
and that's the whole page, you ate it, go forth and enumerate your sensors responsibly π§β¨
this has been your girl from Simple Directmedia Layer, running the SDL 3.4.18 era, signing off with the same energy as always β stay iconic, free your arrays, and don't forget to check SDL_GetError() when the vibes go wrong πππ¦π
π¦ 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