Skip to content

Commit

Permalink
First pass on the new SDL sensor API
Browse files Browse the repository at this point in the history
  • Loading branch information
slouken committed Aug 21, 2018
1 parent c2791fc commit 7c3040e
Show file tree
Hide file tree
Showing 26 changed files with 1,407 additions and 3 deletions.
1 change: 1 addition & 0 deletions .hgignore
Expand Up @@ -112,6 +112,7 @@ test/testresample
test/testrumble
test/testscale
test/testsem
test/testsensor
test/testshader
test/testshape
test/testsprite2
Expand Down
2 changes: 2 additions & 0 deletions Android.mk
Expand Up @@ -36,6 +36,8 @@ LOCAL_SRC_FILES := \
$(wildcard $(LOCAL_PATH)/src/power/*.c) \
$(wildcard $(LOCAL_PATH)/src/power/android/*.c) \
$(wildcard $(LOCAL_PATH)/src/filesystem/android/*.c) \
$(wildcard $(LOCAL_PATH)/src/sensor/*.c) \
$(wildcard $(LOCAL_PATH)/src/sensor/android/*.c) \
$(wildcard $(LOCAL_PATH)/src/render/*.c) \
$(wildcard $(LOCAL_PATH)/src/render/*/*.c) \
$(wildcard $(LOCAL_PATH)/src/stdlib/*.c) \
Expand Down
4 changes: 4 additions & 0 deletions CMakeLists.txt
Expand Up @@ -750,6 +750,10 @@ if(SDL_HAPTIC)
file(GLOB HAPTIC_SOURCES ${SDL2_SOURCE_DIR}/src/haptic/*.c)
set(SOURCE_FILES ${SOURCE_FILES} ${HAPTIC_SOURCES})
endif()
if(SDL_SENSOR)
file(GLOB SENSOR_SOURCES ${SDL2_SOURCE_DIR}/src/sensor/*.c)
set(SOURCE_FILES ${SOURCE_FILES} ${SENSOR_SOURCES})
endif()
if(SDL_POWER)
file(GLOB POWER_SOURCES ${SDL2_SOURCE_DIR}/src/power/*.c)
set(SOURCE_FILES ${SOURCE_FILES} ${POWER_SOURCES})
Expand Down
1 change: 1 addition & 0 deletions Makefile.in
Expand Up @@ -101,6 +101,7 @@ HDRS = \
SDL_render.h \
SDL_rwops.h \
SDL_scancode.h \
SDL_sensor.h \
SDL_shape.h \
SDL_stdinc.h \
SDL_surface.h \
Expand Down
1 change: 1 addition & 0 deletions Makefile.minimal
Expand Up @@ -22,6 +22,7 @@ SOURCES = \
src/filesystem/dummy/*.c \
src/render/*.c \
src/render/software/*.c \
src/sensor/*.c \
src/stdlib/*.c \
src/thread/*.c \
src/thread/generic/*.c \
Expand Down
2 changes: 1 addition & 1 deletion Makefile.pandora
Expand Up @@ -13,7 +13,7 @@ CFLAGS = -O3 -march=armv7-a -mcpu=cortex-a8 -mtune=cortex-a8 -mfloat-abi=softfp
TARGET = libSDL.a

SOURCES = ./src/*.c ./src/audio/*.c ./src/cpuinfo/*.c ./src/events/*.c \
./src/file/*.c ./src/stdlib/*.c ./src/thread/*.c ./src/timer/*.c ./src/video/*.c \
./src/file/*.c ./src/sensor/*.c ./src/stdlib/*.c ./src/thread/*.c ./src/timer/*.c ./src/video/*.c \
./src/joystick/*.c ./src/haptic/*.c ./src/power/*.c ./src/video/dummy/*.c ./src/audio/disk/*.c \
./src/audio/dummy/*.c ./src/loadso/dlopen/*.c ./src/audio/dsp/*.c \
./src/thread/pthread/SDL_systhread.c ./src/thread/pthread/SDL_syssem.c \
Expand Down
1 change: 1 addition & 0 deletions Makefile.psp
Expand Up @@ -42,6 +42,7 @@ OBJS= src/SDL.o \
src/render/software/SDL_drawpoint.o \
src/render/software/SDL_render_sw.o \
src/render/software/SDL_rotate.o \
src/sensor/SDL_sensor.o \
src/stdlib/SDL_getenv.o \
src/stdlib/SDL_iconv.o \
src/stdlib/SDL_malloc.o \
Expand Down
2 changes: 1 addition & 1 deletion Makefile.wiz
Expand Up @@ -13,7 +13,7 @@ TARGET_STATIC = libSDL2.a
TARGET_SHARED = libSDL2.so

SOURCES = ./src/*.c ./src/audio/*.c ./src/cpuinfo/*.c ./src/events/*.c \
./src/file/*.c ./src/stdlib/*.c ./src/thread/*.c ./src/timer/*.c ./src/video/*.c \
./src/file/*.c ./src/sensor/*.c ./src/stdlib/*.c ./src/thread/*.c ./src/timer/*.c ./src/video/*.c \
./src/joystick/*.c ./src/haptic/*.c ./src/video/dummy/*.c ./src/audio/disk/*.c \
./src/audio/dummy/*.c ./src/loadso/dlopen/*.c ./src/audio/dsp/*.c \
./src/thread/pthread/SDL_systhread.c ./src/thread/pthread/SDL_syssem.c \
Expand Down
41 changes: 41 additions & 0 deletions Xcode/SDL/SDL.xcodeproj/project.pbxproj
Expand Up @@ -904,6 +904,18 @@
DB31407217554B71006C0E22 /* Carbon.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 007317C10858E15000B2BC32 /* Carbon.framework */; };
DB31408B17554D37006C0E22 /* ForceFeedback.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 00CFA89C106B4BA100758660 /* ForceFeedback.framework */; };
DB31408D17554D3C006C0E22 /* ForceFeedback.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 00CFA89C106B4BA100758660 /* ForceFeedback.framework */; };
F30D9C84212BC94F0047DF2E /* SDL_sensor_c.h in Headers */ = {isa = PBXBuildFile; fileRef = F30D9C81212BC94E0047DF2E /* SDL_sensor_c.h */; };
F30D9C85212BC94F0047DF2E /* SDL_sensor_c.h in Headers */ = {isa = PBXBuildFile; fileRef = F30D9C81212BC94E0047DF2E /* SDL_sensor_c.h */; };
F30D9C86212BC94F0047DF2E /* SDL_sensor_c.h in Headers */ = {isa = PBXBuildFile; fileRef = F30D9C81212BC94E0047DF2E /* SDL_sensor_c.h */; };
F30D9C87212BC94F0047DF2E /* SDL_syssensor.h in Headers */ = {isa = PBXBuildFile; fileRef = F30D9C82212BC94F0047DF2E /* SDL_syssensor.h */; };
F30D9C88212BC94F0047DF2E /* SDL_syssensor.h in Headers */ = {isa = PBXBuildFile; fileRef = F30D9C82212BC94F0047DF2E /* SDL_syssensor.h */; };
F30D9C89212BC94F0047DF2E /* SDL_syssensor.h in Headers */ = {isa = PBXBuildFile; fileRef = F30D9C82212BC94F0047DF2E /* SDL_syssensor.h */; };
F30D9C8A212BC94F0047DF2E /* SDL_sensor.c in Sources */ = {isa = PBXBuildFile; fileRef = F30D9C83212BC94F0047DF2E /* SDL_sensor.c */; };
F30D9C8B212BC94F0047DF2E /* SDL_sensor.c in Sources */ = {isa = PBXBuildFile; fileRef = F30D9C83212BC94F0047DF2E /* SDL_sensor.c */; };
F30D9C8C212BC94F0047DF2E /* SDL_sensor.c in Sources */ = {isa = PBXBuildFile; fileRef = F30D9C83212BC94F0047DF2E /* SDL_sensor.c */; };
F3950CD8212BC88D00F51292 /* SDL_sensor.h in Headers */ = {isa = PBXBuildFile; fileRef = F3950CD7212BC88D00F51292 /* SDL_sensor.h */; settings = {ATTRIBUTES = (Public, ); }; };
F3950CD9212BC88D00F51292 /* SDL_sensor.h in Headers */ = {isa = PBXBuildFile; fileRef = F3950CD7212BC88D00F51292 /* SDL_sensor.h */; settings = {ATTRIBUTES = (Public, ); }; };
F3950CDA212BC88D00F51292 /* SDL_sensor.h in Headers */ = {isa = PBXBuildFile; fileRef = F3950CD7212BC88D00F51292 /* SDL_sensor.h */; settings = {ATTRIBUTES = (Public, ); }; };
FA73671D19A540EF004122E4 /* CoreVideo.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FA73671C19A540EF004122E4 /* CoreVideo.framework */; };
FA73671E19A54140004122E4 /* CoreVideo.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FA73671C19A540EF004122E4 /* CoreVideo.framework */; };
FA73671F19A54144004122E4 /* CoreVideo.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FA73671C19A540EF004122E4 /* CoreVideo.framework */; };
Expand Down Expand Up @@ -1229,6 +1241,10 @@
D55A1B80179F262300625D7C /* SDL_cocoamousetap.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SDL_cocoamousetap.m; sourceTree = "<group>"; };
DB31407717554B71006C0E22 /* libSDL2.dylib */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.dylib"; includeInIndex = 0; path = libSDL2.dylib; sourceTree = BUILT_PRODUCTS_DIR; };
DB89958518A1A5C50092407C /* SDL_syshaptic_c.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SDL_syshaptic_c.h; sourceTree = "<group>"; };
F30D9C81212BC94E0047DF2E /* SDL_sensor_c.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_sensor_c.h; sourceTree = "<group>"; };
F30D9C82212BC94F0047DF2E /* SDL_syssensor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_syssensor.h; sourceTree = "<group>"; };
F30D9C83212BC94F0047DF2E /* SDL_sensor.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_sensor.c; sourceTree = "<group>"; };
F3950CD7212BC88D00F51292 /* SDL_sensor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_sensor.h; sourceTree = "<group>"; };
F59C710300D5CB5801000001 /* ReadMe.txt */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text; path = ReadMe.txt; sourceTree = "<group>"; };
F59C710600D5CB5801000001 /* SDL.info */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text; path = SDL.info; sourceTree = "<group>"; };
F5A2EF3900C6A39A01000001 /* BUGS.txt */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text; name = BUGS.txt; path = ../../BUGS.txt; sourceTree = SOURCE_ROOT; };
Expand Down Expand Up @@ -1348,6 +1364,7 @@
AA7557EB1595D4D800BBD41B /* SDL_revision.h */,
AA7557EC1595D4D800BBD41B /* SDL_rwops.h */,
AA7557ED1595D4D800BBD41B /* SDL_scancode.h */,
F3950CD7212BC88D00F51292 /* SDL_sensor.h */,
AA7557EE1595D4D800BBD41B /* SDL_shape.h */,
AA7557EF1595D4D800BBD41B /* SDL_stdinc.h */,
AA7557F01595D4D800BBD41B /* SDL_surface.h */,
Expand Down Expand Up @@ -1856,6 +1873,7 @@
04BDFE2F12E6671700899322 /* loadso */,
04BDFE4512E6671700899322 /* power */,
041B2C9712FA0D680087D585 /* render */,
F3950CDB212BC8BC00F51292 /* sensor */,
04BDFE5D12E6671700899322 /* stdlib */,
04BDFE6412E6671800899322 /* thread */,
04BDFE9512E6671800899322 /* timer */,
Expand Down Expand Up @@ -1980,6 +1998,17 @@
name = "Linked Frameworks";
sourceTree = "<group>";
};
F3950CDB212BC8BC00F51292 /* sensor */ = {
isa = PBXGroup;
children = (
F30D9C81212BC94E0047DF2E /* SDL_sensor_c.h */,
F30D9C83212BC94F0047DF2E /* SDL_sensor.c */,
F30D9C82212BC94F0047DF2E /* SDL_syssensor.h */,
);
name = sensor;
path = ../../src/sensor;
sourceTree = SOURCE_ROOT;
};
F59C70FC00D5CB5801000001 /* pkg-support */ = {
isa = PBXGroup;
children = (
Expand Down Expand Up @@ -2011,6 +2040,7 @@
AA75585E1595D4D800BBD41B /* SDL.h in Headers */,
AA7557FE1595D4D800BBD41B /* SDL_assert.h in Headers */,
AA7558001595D4D800BBD41B /* SDL_atomic.h in Headers */,
F30D9C87212BC94F0047DF2E /* SDL_syssensor.h in Headers */,
AA7558021595D4D800BBD41B /* SDL_audio.h in Headers */,
AADA5B8716CCAB3000107CF7 /* SDL_bits.h in Headers */,
AA7558041595D4D800BBD41B /* SDL_blendmode.h in Headers */,
Expand All @@ -2031,7 +2061,9 @@
AA75581A1595D4D800BBD41B /* SDL_hints.h in Headers */,
AA75581E1595D4D800BBD41B /* SDL_joystick.h in Headers */,
AA7558201595D4D800BBD41B /* SDL_keyboard.h in Headers */,
F3950CD8212BC88D00F51292 /* SDL_sensor.h in Headers */,
AA7558221595D4D800BBD41B /* SDL_keycode.h in Headers */,
F30D9C84212BC94F0047DF2E /* SDL_sensor_c.h in Headers */,
AA7558241595D4D800BBD41B /* SDL_loadso.h in Headers */,
AA7558261595D4D800BBD41B /* SDL_log.h in Headers */,
5C2EF6F91FC9EE35003F5197 /* SDL_egl_c.h in Headers */,
Expand Down Expand Up @@ -2186,6 +2218,7 @@
AA7558051595D4D800BBD41B /* SDL_blendmode.h in Headers */,
AA7558071595D4D800BBD41B /* SDL_clipboard.h in Headers */,
AA75580B1595D4D800BBD41B /* SDL_config.h in Headers */,
F30D9C85212BC94F0047DF2E /* SDL_sensor_c.h in Headers */,
AA7558091595D4D800BBD41B /* SDL_config_macosx.h in Headers */,
AA75580D1595D4D800BBD41B /* SDL_copying.h in Headers */,
AA75580F1595D4D800BBD41B /* SDL_cpuinfo.h in Headers */,
Expand Down Expand Up @@ -2230,6 +2263,7 @@
AA7558511595D4D800BBD41B /* SDL_syswm.h in Headers */,
AAC070FA195606770073DCDF /* SDL_opengl_glext.h in Headers */,
AA7558531595D4D800BBD41B /* SDL_thread.h in Headers */,
F30D9C88212BC94F0047DF2E /* SDL_syssensor.h in Headers */,
AA7558551595D4D800BBD41B /* SDL_timer.h in Headers */,
AA7558571595D4D800BBD41B /* SDL_touch.h in Headers */,
AA7558591595D4D800BBD41B /* SDL_types.h in Headers */,
Expand Down Expand Up @@ -2269,6 +2303,7 @@
04BD028212E6671800899322 /* SDL_sysjoystick_c.h in Headers */,
04BD028C12E6671800899322 /* SDL_joystick_c.h in Headers */,
04BD028D12E6671800899322 /* SDL_sysjoystick.h in Headers */,
F3950CD9212BC88D00F51292 /* SDL_sensor.h in Headers */,
04BD02B512E6671800899322 /* SDL_assert_c.h in Headers */,
04BD02B812E6671800899322 /* SDL_error_c.h in Headers */,
04BD02D912E6671800899322 /* SDL_sysmutex_c.h in Headers */,
Expand Down Expand Up @@ -2352,6 +2387,7 @@
DB313FCD17554B71006C0E22 /* SDL_blendmode.h in Headers */,
DB313FCE17554B71006C0E22 /* SDL_clipboard.h in Headers */,
DB313FD017554B71006C0E22 /* SDL_config.h in Headers */,
F30D9C86212BC94F0047DF2E /* SDL_sensor_c.h in Headers */,
DB313FCF17554B71006C0E22 /* SDL_config_macosx.h in Headers */,
DB313FD117554B71006C0E22 /* SDL_copying.h in Headers */,
DB313FD217554B71006C0E22 /* SDL_cpuinfo.h in Headers */,
Expand Down Expand Up @@ -2396,6 +2432,7 @@
DB313FF217554B71006C0E22 /* SDL_syswm.h in Headers */,
AAC070FB195606770073DCDF /* SDL_opengl_glext.h in Headers */,
DB313FF317554B71006C0E22 /* SDL_thread.h in Headers */,
F30D9C89212BC94F0047DF2E /* SDL_syssensor.h in Headers */,
DB313FF417554B71006C0E22 /* SDL_timer.h in Headers */,
DB313FF517554B71006C0E22 /* SDL_touch.h in Headers */,
DB313FF617554B71006C0E22 /* SDL_types.h in Headers */,
Expand Down Expand Up @@ -2435,6 +2472,7 @@
DB313F8C17554B71006C0E22 /* SDL_sysjoystick_c.h in Headers */,
DB313F8D17554B71006C0E22 /* SDL_joystick_c.h in Headers */,
DB313F8E17554B71006C0E22 /* SDL_sysjoystick.h in Headers */,
F3950CDA212BC88D00F51292 /* SDL_sensor.h in Headers */,
DB313F8F17554B71006C0E22 /* SDL_assert_c.h in Headers */,
DB313F9017554B71006C0E22 /* SDL_error_c.h in Headers */,
DB313F9217554B71006C0E22 /* SDL_sysmutex_c.h in Headers */,
Expand Down Expand Up @@ -2774,6 +2812,7 @@
0442EC5A12FE1C60004C9285 /* SDL_x11framebuffer.c in Sources */,
0442EC5F12FE1C75004C9285 /* SDL_hints.c in Sources */,
56A67024185654B40007D20F /* SDL_dynapi.c in Sources */,
F30D9C8A212BC94F0047DF2E /* SDL_sensor.c in Sources */,
04BAC0C81300C2160055DE28 /* SDL_log.c in Sources */,
5C2EF6EE1FC9D0ED003F5197 /* SDL_cocoaopengles.m in Sources */,
0435673E1303160F00BA5428 /* SDL_shaders_gl.c in Sources */,
Expand Down Expand Up @@ -2909,6 +2948,7 @@
04F7805E12FB74A200FC43C0 /* SDL_drawpoint.c in Sources */,
0442EC1912FE1BBA004C9285 /* SDL_render_gl.c in Sources */,
0442EC1F12FE1BCB004C9285 /* SDL_render_sw.c in Sources */,
F30D9C8B212BC94F0047DF2E /* SDL_sensor.c in Sources */,
56A67025185654B40007D20F /* SDL_dynapi.c in Sources */,
0442EC5C12FE1C60004C9285 /* SDL_x11framebuffer.c in Sources */,
0442EC6012FE1C75004C9285 /* SDL_hints.c in Sources */,
Expand Down Expand Up @@ -3044,6 +3084,7 @@
DB31406017554B71006C0E22 /* SDL_drawpoint.c in Sources */,
DB31406117554B71006C0E22 /* SDL_render_gl.c in Sources */,
DB31406217554B71006C0E22 /* SDL_render_sw.c in Sources */,
F30D9C8C212BC94F0047DF2E /* SDL_sensor.c in Sources */,
56A67026185654B40007D20F /* SDL_dynapi.c in Sources */,
DB31406317554B71006C0E22 /* SDL_x11framebuffer.c in Sources */,
DB31406417554B71006C0E22 /* SDL_hints.c in Sources */,
Expand Down
17 changes: 17 additions & 0 deletions configure
Expand Up @@ -785,6 +785,7 @@ enable_render
enable_events
enable_joystick
enable_haptic
enable_sensor
enable_power
enable_filesystem
enable_threads
Expand Down Expand Up @@ -1523,6 +1524,7 @@ Optional Features:
--enable-joystick Enable the joystick subsystem [[default=yes]]
--enable-haptic Enable the haptic (force feedback) subsystem
[[default=yes]]
--enable-sensor Enable the sensor subsystem [[default=yes]]
--enable-power Enable the power subsystem [[default=yes]]
--enable-filesystem Enable the filesystem subsystem [[default=yes]]
--enable-threads Enable the threading subsystem [[default=yes]]
Expand Down Expand Up @@ -16884,6 +16886,7 @@ SOURCES="$SOURCES $srcdir/src/power/*.c"
#SOURCES="$SOURCES $srcdir/src/filesystem/*.c"
SOURCES="$SOURCES $srcdir/src/render/*.c"
SOURCES="$SOURCES $srcdir/src/render/*/*.c"
SOURCES="$SOURCES $srcdir/src/sensor/*.c"
SOURCES="$SOURCES $srcdir/src/stdlib/*.c"
SOURCES="$SOURCES $srcdir/src/thread/*.c"
SOURCES="$SOURCES $srcdir/src/timer/*.c"
Expand Down Expand Up @@ -16989,6 +16992,20 @@ $as_echo "#define SDL_HAPTIC_DISABLED 1" >>confdefs.h
else
SUMMARY_modules="${SUMMARY_modules} haptic"
fi
# Check whether --enable-sensor was given.
if test "${enable_sensor+set}" = set; then :
enableval=$enable_sensor;
else
enable_sensor=yes
fi

if test x$enable_sensor != xyes; then

$as_echo "#define SDL_SENSOR_DISABLED 1" >>confdefs.h

else
SUMMARY_modules="${SUMMARY_modules} sensor"
fi
# Check whether --enable-power was given.
if test "${enable_power+set}" = set; then :
enableval=$enable_power;
Expand Down
9 changes: 9 additions & 0 deletions configure.in
Expand Up @@ -346,6 +346,7 @@ SOURCES="$SOURCES $srcdir/src/power/*.c"
#SOURCES="$SOURCES $srcdir/src/filesystem/*.c"
SOURCES="$SOURCES $srcdir/src/render/*.c"
SOURCES="$SOURCES $srcdir/src/render/*/*.c"
SOURCES="$SOURCES $srcdir/src/sensor/*.c"
SOURCES="$SOURCES $srcdir/src/stdlib/*.c"
SOURCES="$SOURCES $srcdir/src/thread/*.c"
SOURCES="$SOURCES $srcdir/src/timer/*.c"
Expand Down Expand Up @@ -410,6 +411,14 @@ if test x$enable_haptic != xyes; then
else
SUMMARY_modules="${SUMMARY_modules} haptic"
fi
AC_ARG_ENABLE(sensor,
AC_HELP_STRING([--enable-sensor], [Enable the sensor subsystem [[default=yes]]]),
, enable_sensor=yes)
if test x$enable_sensor != xyes; then
AC_DEFINE(SDL_SENSOR_DISABLED, 1, [ ])
else
SUMMARY_modules="${SUMMARY_modules} sensor"
fi
AC_ARG_ENABLE(power,
AC_HELP_STRING([--enable-power], [Enable the power subsystem [[default=yes]]]),
, enable_power=yes)
Expand Down
4 changes: 3 additions & 1 deletion include/SDL.h
Expand Up @@ -51,6 +51,7 @@
#include "SDL_power.h"
#include "SDL_render.h"
#include "SDL_rwops.h"
#include "SDL_sensor.h"
#include "SDL_shape.h"
#include "SDL_system.h"
#include "SDL_thread.h"
Expand Down Expand Up @@ -80,10 +81,11 @@ extern "C" {
#define SDL_INIT_HAPTIC 0x00001000u
#define SDL_INIT_GAMECONTROLLER 0x00002000u /**< SDL_INIT_GAMECONTROLLER implies SDL_INIT_JOYSTICK */
#define SDL_INIT_EVENTS 0x00004000u
#define SDL_INIT_SENSOR 0x00008000u
#define SDL_INIT_NOPARACHUTE 0x00100000u /**< compatibility; this flag is ignored. */
#define SDL_INIT_EVERYTHING ( \
SDL_INIT_TIMER | SDL_INIT_AUDIO | SDL_INIT_VIDEO | SDL_INIT_EVENTS | \
SDL_INIT_JOYSTICK | SDL_INIT_HAPTIC | SDL_INIT_GAMECONTROLLER \
SDL_INIT_JOYSTICK | SDL_INIT_HAPTIC | SDL_INIT_GAMECONTROLLER | SDL_INIT_SENSOR \
)
/* @} */

Expand Down
3 changes: 3 additions & 0 deletions include/SDL_config_android.h
Expand Up @@ -137,6 +137,9 @@
#define SDL_JOYSTICK_HIDAPI 1
#define SDL_HAPTIC_ANDROID 1

/* Enable sensor driver */
#define SDL_SENSOR_ANDROID 1

/* Enable various shared object loading systems */
#define SDL_LOADSO_DLOPEN 1

Expand Down
15 changes: 15 additions & 0 deletions include/SDL_events.h
Expand Up @@ -144,6 +144,9 @@ typedef enum
SDL_AUDIODEVICEADDED = 0x1100, /**< A new audio device is available */
SDL_AUDIODEVICEREMOVED, /**< An audio device has been removed. */

/* Sensor events */
SDL_SENSORUPDATE = 0x1200, /**< A sensor was updated */

/* Render events */
SDL_RENDER_TARGETS_RESET = 0x2000, /**< The render targets have been reset and their contents need to be updated */
SDL_RENDER_DEVICE_RESET, /**< The device has been reset and all textures need to be recreated */
Expand Down Expand Up @@ -471,6 +474,17 @@ typedef struct SDL_DropEvent
} SDL_DropEvent;


/**
* \brief Sensor event structure (event.sensor.*)
*/
typedef struct SDL_SensorEvent
{
Uint32 type; /**< ::SDL_SENSORUPDATE */
Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */
Sint32 which; /**< The instance ID of the sensor */
float data[6]; /**< Up to 6 values from the sensor - additional values can be queried using SDL_SensorGetData() */
} SDL_SensorEvent;

/**
* \brief The "quit requested" event
*/
Expand Down Expand Up @@ -542,6 +556,7 @@ typedef union SDL_Event
SDL_ControllerButtonEvent cbutton; /**< Game Controller button event data */
SDL_ControllerDeviceEvent cdevice; /**< Game Controller device event data */
SDL_AudioDeviceEvent adevice; /**< Audio device event data */
SDL_SensorEvent sensor; /**< Sensor event data */
SDL_QuitEvent quit; /**< Quit request event data */
SDL_UserEvent user; /**< Custom event data */
SDL_SysWMEvent syswm; /**< System dependent window event data */
Expand Down

0 comments on commit 7c3040e

Please sign in to comment.