summaryrefslogtreecommitdiff
path: root/sdl2/bindings.scm
diff options
context:
space:
mode:
authorDavid Thompson <dthompson2@worcester.edu>2022-10-23 07:13:48 -0400
committerDavid Thompson <dthompson2@worcester.edu>2022-10-23 07:13:48 -0400
commit34ec6b54f26445ff4a5d0740d477a06f55521f53 (patch)
tree340a320f41017142ec7b9f47aa93ff8fbb393acd /sdl2/bindings.scm
parentcbea03938464578e58cc465ba4f89cd33a054224 (diff)
Add beginnings of sensor API bindings.
Not adding anything to manual at this time because the bindings aren't really usable yet.
Diffstat (limited to 'sdl2/bindings.scm')
-rw-r--r--sdl2/bindings.scm62
1 files changed, 62 insertions, 0 deletions
diff --git a/sdl2/bindings.scm b/sdl2/bindings.scm
index 480cf71..02988ad 100644
--- a/sdl2/bindings.scm
+++ b/sdl2/bindings.scm
@@ -1065,6 +1065,68 @@ RETURN-TYPE and accept arguments of ARG-TYPES."
;;;
+;;; Sensors
+;;;
+
+(define-public SDL_SENSOR_INVALID -1)
+(define-public SDL_SENSOR_UNKNOWN 0)
+(define-public SDL_SENSOR_ACCEL 1)
+(define-public SDL_SENSOR_GYRO 2)
+(define-public SDL_SENSOR_ACCEL_L 3)
+(define-public SDL_SENSOR_GYRO_L 4)
+(define-public SDL_SENSOR_ACCEL_R 5)
+(define-public SDL_SENSOR_GYRO_R 6)
+
+(define-public SDL_STANDARD_GRAVITY 9.80665)
+
+(define-foreign sdl-num-sensors
+ int "SDL_NumSensors" '())
+
+(define-foreign sdl-sensor-get-device-name
+ '* "SDL_SensorGetDeviceName" (list int))
+
+(define-foreign sdl-sensor-get-device-type
+ int "SDL_SensorGetDeviceType" (list int))
+
+(define-foreign sdl-sensor-get-device-non-portable-type
+ int "SDL_SensorGetDeviceNonPortableType" (list int))
+
+(define-foreign sdl-sensor-get-device-instance-id
+ int "SDL_SensorGetDeviceInstanceID" (list int))
+
+(define-foreign sdl-sensor-open
+ '* "SDL_SensorOpen" (list int))
+
+(define-foreign sdl-sensor-from-instance-id
+ '* "SDL_SensorFromInstanceID" (list int))
+
+(define-foreign sdl-sensor-get-name
+ '* "SDL_SensorGetName" '(*))
+
+(define-foreign sdl-sensor-get-type
+ int "SDL_SensorGetType" '(*))
+
+(define-foreign sdl-sensor-get-non-portable-type
+ int "SDL_SensorGetNonPortableType" '(*))
+
+(define-foreign sdl-sensor-get-instance-id
+ int "SDL_SensorGetInstanceID" '(*))
+
+(define-foreign sdl-sensor-get-data
+ int "SDL_SensorGetData" (list '* '* int))
+
+;; Only available in very recent versions of SDL2.
+;; (define-foreign sdl-sensor-get-data-with-timestamp
+;; int "SDL_SensorGetDataWithTimestamp" (list '* uint64 '* int))
+
+(define-foreign sdl-sensor-close
+ void "SDL_SensorClose" '(*))
+
+(define-foreign sdl-sensor-update
+ void "SDL_SensorUpdate" '())
+
+
+;;;
;;; Timer
;;;