SDL_SensorEvent(3type)

okay so bestie πŸ’– welcome to the SDL_SensorEvent(3type) page from SDL3 DATATYPES. it's giving sensor event energy, and we're gonna read it together, no cap.

✨ NAME ✨

SDL_SensorEvent β€” Sensor event structure (event.sensor.*)

periodt. that's the name, and that little event.sensor.* is how it shows up in the event union. iykyk.


🌸 SYNOPSIS 🌸

first, the include. don't skip it, or your compiler will simply not know what's going on:

#include <SDL3/SDL_events.h>

and here's the struct in all its glory, exactly as written:

typedef struct SDL_SensorEvent
{
    SDL_EventType type; /**< SDL_EVENT_SENSOR_UPDATE */
    Uint32 reserved;
    Uint64 timestamp;   /**< In nanoseconds, populated using SDL_GetTicksNS() */
    SDL_SensorID which; /**< The instance ID of the sensor */
    float data[6];      /**< Up to 6 values from the sensor - additional values can be queried using SDL_GetSensorData() */
    Uint64 sensor_timestamp; /**< The timestamp of the sensor reading in nanoseconds, not necessarily synchronized with the system clock */
} SDL_SensorEvent;

field-by-field vibe check, because every detail matters bestie:

  • SDL_EventType type; β€” the event type, and the comment says it's SDL_EVENT_SENSOR_UPDATE. πŸ’…
  • Uint32 reserved; β€” reserved. no touchy, it's not for you. πŸ™ˆ
  • Uint64 timestamp; β€” in nanoseconds, populated using SDL_GetTicksNS(). ⏱️
  • SDL_SensorID which; β€” the instance ID of the sensor. πŸŽ€
  • float data[6]; β€” up to 6 values from the sensor. need more? additional values can be queried using SDL_GetSensorData(). πŸ”₯
  • Uint64 sensor_timestamp; β€” the timestamp of the sensor reading in nanoseconds, not necessarily synchronized with the system clock. it's on its own clock vibe, fr fr. πŸ•°οΈ

πŸ‘‘ AVAILABILITY πŸ‘‘

This struct is available since SDL 3.2.0.

so if you're kicking it with an older SDL, that's the availability tea. periodt. ✨


mwah πŸ’‹ this page came from Simple Directmedia Layer, version SDL 3.4.18, and it's the SDL_SensorEvent(3type) page. the footer didn't hand me a date, so we're not making one up, bestie β€” that's the whole sign-off. stay slaying, and go read those sensor values. πŸ’–βœ¨πŸ¦‹

πŸ“¦ where this page comes from