| Safe Haskell | None |
|---|---|
| Language | GHC2021 |
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
- data SDL_Sensor
- newtype SDL_SensorID = SDL_SensorID {}
- sDL_STANDARD_GRAVITY :: CFloat
- newtype SDL_SensorType = SDL_SensorType {}
- pattern SDL_SENSOR_INVALID :: SDL_SensorType
- pattern SDL_SENSOR_UNKNOWN :: SDL_SensorType
- pattern SDL_SENSOR_ACCEL :: SDL_SensorType
- pattern SDL_SENSOR_GYRO :: SDL_SensorType
- pattern SDL_SENSOR_ACCEL_L :: SDL_SensorType
- pattern SDL_SENSOR_GYRO_L :: SDL_SensorType
- pattern SDL_SENSOR_ACCEL_R :: SDL_SensorType
- pattern SDL_SENSOR_GYRO_R :: SDL_SensorType
- pattern SDL_SENSOR_COUNT :: SDL_SensorType
Documentation
data SDL_Sensor Source #
- C declaration
struct SDL_Sensor, defined atSDL3/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 atSDL3/SDL_sensor.h 64:16
Since: 3.2.0
Constructors
| SDL_SensorID | |
Instances
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 atSDL3/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 axisvalues[1]: Acceleration on the y axisvalues[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 atSDL3/SDL_sensor.h 132:14
Since: 3.2.0
Constructors
| SDL_SensorType | |
Instances
| Storable SDL_SensorType Source # | |||||
Defined in SDL3.Sys.Bindgen.Sensor Methods sizeOf :: SDL_SensorType -> Int # alignment :: SDL_SensorType -> Int # peekElemOff :: Ptr SDL_SensorType -> Int -> IO SDL_SensorType # pokeElemOff :: Ptr SDL_SensorType -> Int -> SDL_SensorType -> IO () # peekByteOff :: Ptr b -> Int -> IO SDL_SensorType # pokeByteOff :: Ptr b -> Int -> SDL_SensorType -> IO () # peek :: Ptr SDL_SensorType -> IO SDL_SensorType # poke :: Ptr SDL_SensorType -> SDL_SensorType -> IO () # | |||||
| Generic SDL_SensorType Source # | |||||
Defined in SDL3.Sys.Bindgen.Sensor Associated Types
Methods from :: SDL_SensorType -> Rep SDL_SensorType x # to :: Rep SDL_SensorType x -> SDL_SensorType # | |||||
| Read SDL_SensorType Source # | |||||
Defined in SDL3.Sys.Bindgen.Sensor Methods readsPrec :: Int -> ReadS SDL_SensorType # readList :: ReadS [SDL_SensorType] # | |||||
| Show SDL_SensorType Source # | |||||
Defined in SDL3.Sys.Bindgen.Sensor Methods showsPrec :: Int -> SDL_SensorType -> ShowS # show :: SDL_SensorType -> String # showList :: [SDL_SensorType] -> ShowS # | |||||
| Eq SDL_SensorType Source # | |||||
Defined in SDL3.Sys.Bindgen.Sensor Methods (==) :: SDL_SensorType -> SDL_SensorType -> Bool # (/=) :: SDL_SensorType -> SDL_SensorType -> Bool # | |||||
| Ord SDL_SensorType Source # | |||||
Defined in SDL3.Sys.Bindgen.Sensor Methods compare :: SDL_SensorType -> SDL_SensorType -> Ordering # (<) :: SDL_SensorType -> SDL_SensorType -> Bool # (<=) :: SDL_SensorType -> SDL_SensorType -> Bool # (>) :: SDL_SensorType -> SDL_SensorType -> Bool # (>=) :: SDL_SensorType -> SDL_SensorType -> Bool # max :: SDL_SensorType -> SDL_SensorType -> SDL_SensorType # min :: SDL_SensorType -> SDL_SensorType -> SDL_SensorType # | |||||
| Prim SDL_SensorType Source # | |||||
Defined in SDL3.Sys.Bindgen.Sensor Methods sizeOfType# :: Proxy SDL_SensorType -> Int# # sizeOf# :: SDL_SensorType -> Int# # alignmentOfType# :: Proxy SDL_SensorType -> Int# # alignment# :: SDL_SensorType -> Int# # indexByteArray# :: ByteArray# -> Int# -> SDL_SensorType # readByteArray# :: MutableByteArray# s -> Int# -> State# s -> (# State# s, SDL_SensorType #) # writeByteArray# :: MutableByteArray# s -> Int# -> SDL_SensorType -> State# s -> State# s # setByteArray# :: MutableByteArray# s -> Int# -> Int# -> SDL_SensorType -> State# s -> State# s # indexOffAddr# :: Addr# -> Int# -> SDL_SensorType # readOffAddr# :: Addr# -> Int# -> State# s -> (# State# s, SDL_SensorType #) # writeOffAddr# :: Addr# -> Int# -> SDL_SensorType -> State# s -> State# s # setOffAddr# :: Addr# -> Int# -> Int# -> SDL_SensorType -> State# s -> State# s # | |||||
| CEnum SDL_SensorType Source # | |||||
Defined in SDL3.Sys.Bindgen.Sensor Associated Types
Methods toCEnum :: CEnumZ SDL_SensorType -> SDL_SensorType # fromCEnum :: SDL_SensorType -> CEnumZ SDL_SensorType # declaredValues :: proxy SDL_SensorType -> DeclaredValues SDL_SensorType # showsUndeclared :: proxy SDL_SensorType -> Int -> CEnumZ SDL_SensorType -> ShowS # readPrecUndeclared :: ReadPrec SDL_SensorType # isDeclared :: SDL_SensorType -> Bool # mkDeclared :: CEnumZ SDL_SensorType -> Maybe SDL_SensorType # | |||||
| SequentialCEnum SDL_SensorType Source # | |||||
Defined in SDL3.Sys.Bindgen.Sensor | |||||
| HasFFIType SDL_SensorType Source # | |||||
Defined in SDL3.Sys.Bindgen.Sensor Associated Types
Methods | |||||
| ReadRaw SDL_SensorType Source # | |||||
Defined in SDL3.Sys.Bindgen.Sensor Methods readRaw :: Ptr SDL_SensorType -> IO SDL_SensorType # | |||||
| StaticSize SDL_SensorType Source # | |||||
Defined in SDL3.Sys.Bindgen.Sensor Methods staticSizeOf :: Proxy SDL_SensorType -> Int # staticAlignment :: Proxy SDL_SensorType -> Int # | |||||
| WriteRaw SDL_SensorType Source # | |||||
Defined in SDL3.Sys.Bindgen.Sensor Methods writeRaw :: Ptr SDL_SensorType -> SDL_SensorType -> IO () # | |||||
| HasCField SDL_SensorType "unwrap" Source # | |||||
Defined in SDL3.Sys.Bindgen.Sensor Associated Types
| |||||
| ty ~ CInt => HasField "unwrap" SDL_SensorType ty Source # | |||||
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 # | |||||
Defined in SDL3.Sys.Bindgen.Sensor Methods getField :: Ptr SDL_SensorType -> Ptr ty # | |||||
| type Rep SDL_SensorType Source # | |||||
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 # | |||||
Defined in SDL3.Sys.Bindgen.Sensor | |||||
| type FFIType SDL_SensorType Source # | |||||
Defined in SDL3.Sys.Bindgen.Sensor | |||||
| type CFieldType SDL_SensorType "unwrap" Source # | |||||
Defined in SDL3.Sys.Bindgen.Sensor | |||||
pattern SDL_SENSOR_INVALID :: SDL_SensorType Source #
Returned for an invalid sensor
- C declaration
SDL_SENSOR_INVALID, defined atSDL3/SDL_sensor.h 134:5
pattern SDL_SENSOR_UNKNOWN :: SDL_SensorType Source #
Unknown sensor type
- C declaration
SDL_SENSOR_UNKNOWN, defined atSDL3/SDL_sensor.h 135:5
pattern SDL_SENSOR_ACCEL :: SDL_SensorType Source #
Accelerometer
- C declaration
SDL_SENSOR_ACCEL, defined atSDL3/SDL_sensor.h 136:5
pattern SDL_SENSOR_GYRO :: SDL_SensorType Source #
Gyroscope
- C declaration
SDL_SENSOR_GYRO, defined atSDL3/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 atSDL3/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 atSDL3/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 atSDL3/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 atSDL3/SDL_sensor.h 141:5
pattern SDL_SENSOR_COUNT :: SDL_SensorType Source #
- C declaration
SDL_SENSOR_COUNT, defined atSDL3/SDL_sensor.h 142:5