sdl3-bindgen-sys
Safe HaskellNone
LanguageGHC2021

SDL3.Sys.Bindgen.Sensor

Description

SDL sensor management.

These APIs grant access to gyros and accelerometers on various platforms.

In order to use these functions, SDL_Init() must have been called with the SDL_INIT_SENSOR flag. This causes SDL to scan the system for sensors, and load appropriate drivers. The opaque structure used to identify an opened SDL sensor.

Since: 3.2.0

Synopsis

Documentation

data SDL_Sensor Source #

C declaration
struct SDL_Sensor, defined at SDL3/SDL_sensor.h 54:16

newtype SDL_SensorID Source #

This is a unique ID for a sensor for the time it is connected to the system, and is never reused for the lifetime of the application.

The value 0 is an invalid ID.

C declaration
SDL_SensorID, defined at SDL3/SDL_sensor.h 64:16

Since: 3.2.0

Constructors

SDL_SensorID 

Fields

Instances

Instances details
Bits SDL_SensorID Source # 
Instance details

Defined in SDL3.Sys.Bindgen.Sensor

FiniteBits SDL_SensorID Source # 
Instance details

Defined in SDL3.Sys.Bindgen.Sensor

Bounded SDL_SensorID Source # 
Instance details

Defined in SDL3.Sys.Bindgen.Sensor

Enum SDL_SensorID Source # 
Instance details

Defined in SDL3.Sys.Bindgen.Sensor

Storable SDL_SensorID Source # 
Instance details

Defined in SDL3.Sys.Bindgen.Sensor

Generic SDL_SensorID Source # 
Instance details

Defined in SDL3.Sys.Bindgen.Sensor

Associated Types

type Rep SDL_SensorID 
Instance details

Defined in SDL3.Sys.Bindgen.Sensor

type Rep SDL_SensorID = D1 ('MetaData "SDL_SensorID" "SDL3.Sys.Bindgen.Sensor" "sdl3-bindgen-sys-0.0.1.0-inplace" 'True) (C1 ('MetaCons "SDL_SensorID" 'PrefixI 'True) (S1 ('MetaSel ('Just "unwrap") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Uint32)))
Ix SDL_SensorID Source # 
Instance details

Defined in SDL3.Sys.Bindgen.Sensor

Num SDL_SensorID Source # 
Instance details

Defined in SDL3.Sys.Bindgen.Sensor

Read SDL_SensorID Source # 
Instance details

Defined in SDL3.Sys.Bindgen.Sensor

Integral SDL_SensorID Source # 
Instance details

Defined in SDL3.Sys.Bindgen.Sensor

Real SDL_SensorID Source # 
Instance details

Defined in SDL3.Sys.Bindgen.Sensor

Show SDL_SensorID Source # 
Instance details

Defined in SDL3.Sys.Bindgen.Sensor

Eq SDL_SensorID Source # 
Instance details

Defined in SDL3.Sys.Bindgen.Sensor

Ord SDL_SensorID Source # 
Instance details

Defined in SDL3.Sys.Bindgen.Sensor

Prim SDL_SensorID Source # 
Instance details

Defined in SDL3.Sys.Bindgen.Sensor

HasFFIType SDL_SensorID Source # 
Instance details

Defined in SDL3.Sys.Bindgen.Sensor

Associated Types

type FFIType SDL_SensorID 
Instance details

Defined in SDL3.Sys.Bindgen.Sensor

ReadRaw SDL_SensorID Source # 
Instance details

Defined in SDL3.Sys.Bindgen.Sensor

StaticSize SDL_SensorID Source # 
Instance details

Defined in SDL3.Sys.Bindgen.Sensor

WriteRaw SDL_SensorID Source # 
Instance details

Defined in SDL3.Sys.Bindgen.Sensor

Bitfield SDL_SensorID Source # 
Instance details

Defined in SDL3.Sys.Bindgen.Sensor

HasCField SDL_SensorID "unwrap" Source # 
Instance details

Defined in SDL3.Sys.Bindgen.Sensor

Associated Types

type CFieldType SDL_SensorID "unwrap" 
Instance details

Defined in SDL3.Sys.Bindgen.Sensor

Methods

offset# :: Proxy# SDL_SensorID -> Proxy# "unwrap" -> Int #

ty ~ Uint32 => HasField "unwrap" SDL_SensorID ty Source # 
Instance details

Defined in SDL3.Sys.Bindgen.Sensor

Methods

hasField :: SDL_SensorID -> (ty -> SDL_SensorID, ty) #

ty ~ Uint32 => HasField "unwrap" (Ptr SDL_SensorID) (Ptr ty :: Type) Source # 
Instance details

Defined in SDL3.Sys.Bindgen.Sensor

Methods

getField :: Ptr SDL_SensorID -> Ptr ty #

type Rep SDL_SensorID Source # 
Instance details

Defined in SDL3.Sys.Bindgen.Sensor

type Rep SDL_SensorID = D1 ('MetaData "SDL_SensorID" "SDL3.Sys.Bindgen.Sensor" "sdl3-bindgen-sys-0.0.1.0-inplace" 'True) (C1 ('MetaCons "SDL_SensorID" 'PrefixI 'True) (S1 ('MetaSel ('Just "unwrap") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Uint32)))
type FFIType SDL_SensorID Source # 
Instance details

Defined in SDL3.Sys.Bindgen.Sensor

type CFieldType SDL_SensorID "unwrap" Source # 
Instance details

Defined in SDL3.Sys.Bindgen.Sensor

sDL_STANDARD_GRAVITY :: CFloat Source #

A constant to represent standard gravity for accelerometer sensors.

The accelerometer returns the current acceleration in SI meters per second squared. This measurement includes the force of gravity, so a device at rest will have an value of SDL_STANDARD_GRAVITY away from the center of the earth, which is a positive Y value.

C declaration
macro SDL_STANDARD_GRAVITY, defined at SDL3/SDL_sensor.h 76:9

Since: 3.2.0

newtype SDL_SensorType Source #

The different sensors defined by SDL.

Additional sensors may be available, using platform dependent semantics.

Here are the additional Android sensors:

https://developer.android.com/reference/android/hardware/SensorEvent.html#values

Accelerometer sensor notes:

The accelerometer returns the current acceleration in SI meters per second squared. This measurement includes the force of gravity, so a device at rest will have an value of SDL_STANDARD_GRAVITY away from the center of the earth, which is a positive Y value.

  • values[0]: Acceleration on the x axis
  • values[1]: Acceleration on the y axis
  • values[2]: Acceleration on the z axis

For phones and tablets held in natural orientation and game controllers held in front of you, the axes are defined as follows:

  • -X ... +X : left ... right
  • -Y ... +Y : bottom ... top
  • -Z ... +Z : farther ... closer

The accelerometer axis data is not changed when the device is rotated.

Gyroscope sensor notes:

The gyroscope returns the current rate of rotation in radians per second. The rotation is positive in the counter-clockwise direction. That is, an observer looking from a positive location on one of the axes would see positive rotation on that axis when it appeared to be rotating counter-clockwise.

  • values[0]: Angular speed around the x axis (pitch)
  • values[1]: Angular speed around the y axis (yaw)
  • values[2]: Angular speed around the z axis (roll)

For phones and tablets held in natural orientation and game controllers held in front of you, the axes are defined as follows:

  • -X ... +X : left ... right
  • -Y ... +Y : bottom ... top
  • -Z ... +Z : farther ... closer

The gyroscope axis data is not changed when the device is rotated.

See also
SDL_GetCurrentDisplayOrientation
C declaration
enum SDL_SensorType, defined at SDL3/SDL_sensor.h 132:14

Since: 3.2.0

Constructors

SDL_SensorType 

Fields

Instances

Instances details
Storable SDL_SensorType Source # 
Instance details

Defined in SDL3.Sys.Bindgen.Sensor

Generic SDL_SensorType Source # 
Instance details

Defined in SDL3.Sys.Bindgen.Sensor

Associated Types

type Rep SDL_SensorType 
Instance details

Defined in SDL3.Sys.Bindgen.Sensor

type Rep SDL_SensorType = D1 ('MetaData "SDL_SensorType" "SDL3.Sys.Bindgen.Sensor" "sdl3-bindgen-sys-0.0.1.0-inplace" 'True) (C1 ('MetaCons "SDL_SensorType" 'PrefixI 'True) (S1 ('MetaSel ('Just "unwrap") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 CInt)))
Read SDL_SensorType Source # 
Instance details

Defined in SDL3.Sys.Bindgen.Sensor

Show SDL_SensorType Source # 
Instance details

Defined in SDL3.Sys.Bindgen.Sensor

Eq SDL_SensorType Source # 
Instance details

Defined in SDL3.Sys.Bindgen.Sensor

Ord SDL_SensorType Source # 
Instance details

Defined in SDL3.Sys.Bindgen.Sensor

Prim SDL_SensorType Source # 
Instance details

Defined in SDL3.Sys.Bindgen.Sensor

CEnum SDL_SensorType Source # 
Instance details

Defined in SDL3.Sys.Bindgen.Sensor

Associated Types

type CEnumZ SDL_SensorType 
Instance details

Defined in SDL3.Sys.Bindgen.Sensor

SequentialCEnum SDL_SensorType Source # 
Instance details

Defined in SDL3.Sys.Bindgen.Sensor

HasFFIType SDL_SensorType Source # 
Instance details

Defined in SDL3.Sys.Bindgen.Sensor

Associated Types

type FFIType SDL_SensorType 
Instance details

Defined in SDL3.Sys.Bindgen.Sensor

ReadRaw SDL_SensorType Source # 
Instance details

Defined in SDL3.Sys.Bindgen.Sensor

StaticSize SDL_SensorType Source # 
Instance details

Defined in SDL3.Sys.Bindgen.Sensor

WriteRaw SDL_SensorType Source # 
Instance details

Defined in SDL3.Sys.Bindgen.Sensor

HasCField SDL_SensorType "unwrap" Source # 
Instance details

Defined in SDL3.Sys.Bindgen.Sensor

Associated Types

type CFieldType SDL_SensorType "unwrap" 
Instance details

Defined in SDL3.Sys.Bindgen.Sensor

Methods

offset# :: Proxy# SDL_SensorType -> Proxy# "unwrap" -> Int #

ty ~ CInt => HasField "unwrap" SDL_SensorType ty Source # 
Instance details

Defined in SDL3.Sys.Bindgen.Sensor

Methods

hasField :: SDL_SensorType -> (ty -> SDL_SensorType, ty) #

ty ~ CInt => HasField "unwrap" (Ptr SDL_SensorType) (Ptr ty :: Type) Source # 
Instance details

Defined in SDL3.Sys.Bindgen.Sensor

Methods

getField :: Ptr SDL_SensorType -> Ptr ty #

type Rep SDL_SensorType Source # 
Instance details

Defined in SDL3.Sys.Bindgen.Sensor

type Rep SDL_SensorType = D1 ('MetaData "SDL_SensorType" "SDL3.Sys.Bindgen.Sensor" "sdl3-bindgen-sys-0.0.1.0-inplace" 'True) (C1 ('MetaCons "SDL_SensorType" 'PrefixI 'True) (S1 ('MetaSel ('Just "unwrap") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 CInt)))
type CEnumZ SDL_SensorType Source # 
Instance details

Defined in SDL3.Sys.Bindgen.Sensor

type FFIType SDL_SensorType Source # 
Instance details

Defined in SDL3.Sys.Bindgen.Sensor

type CFieldType SDL_SensorType "unwrap" Source # 
Instance details

Defined in SDL3.Sys.Bindgen.Sensor

pattern SDL_SENSOR_INVALID :: SDL_SensorType Source #

Returned for an invalid sensor

C declaration
SDL_SENSOR_INVALID, defined at SDL3/SDL_sensor.h 134:5

pattern SDL_SENSOR_UNKNOWN :: SDL_SensorType Source #

Unknown sensor type

C declaration
SDL_SENSOR_UNKNOWN, defined at SDL3/SDL_sensor.h 135:5

pattern SDL_SENSOR_ACCEL :: SDL_SensorType Source #

Accelerometer

C declaration
SDL_SENSOR_ACCEL, defined at SDL3/SDL_sensor.h 136:5

pattern SDL_SENSOR_GYRO :: SDL_SensorType Source #

Gyroscope

C declaration
SDL_SENSOR_GYRO, defined at SDL3/SDL_sensor.h 137:5

pattern SDL_SENSOR_ACCEL_L :: SDL_SensorType Source #

Accelerometer for left Joy-Con controller and Wii nunchuk

C declaration
SDL_SENSOR_ACCEL_L, defined at SDL3/SDL_sensor.h 138:5

pattern SDL_SENSOR_GYRO_L :: SDL_SensorType Source #

Gyroscope for left Joy-Con controller

C declaration
SDL_SENSOR_GYRO_L, defined at SDL3/SDL_sensor.h 139:5

pattern SDL_SENSOR_ACCEL_R :: SDL_SensorType Source #

Accelerometer for right Joy-Con controller

C declaration
SDL_SENSOR_ACCEL_R, defined at SDL3/SDL_sensor.h 140:5

pattern SDL_SENSOR_GYRO_R :: SDL_SensorType Source #

Gyroscope for right Joy-Con controller

C declaration
SDL_SENSOR_GYRO_R, defined at SDL3/SDL_sensor.h 141:5

pattern SDL_SENSOR_COUNT :: SDL_SensorType Source #

C declaration
SDL_SENSOR_COUNT, defined at SDL3/SDL_sensor.h 142:5