summaryrefslogtreecommitdiff
path: root/Source/3rdParty/SDL2/src/SDL.c
diff options
context:
space:
mode:
authorchai <chaifix@163.com>2019-01-31 18:38:35 +0800
committerchai <chaifix@163.com>2019-01-31 18:38:35 +0800
commit2ec55fd974a63b705a4777c256d2222c874fa043 (patch)
tree48f1fea59ee9fc713a28a9aac3f05b98dc5ae66f /Source/3rdParty/SDL2/src/SDL.c
parentc581dfbf1e849f393861d15e82aa6446c0c1c310 (diff)
*SDL project
Diffstat (limited to 'Source/3rdParty/SDL2/src/SDL.c')
-rw-r--r--Source/3rdParty/SDL2/src/SDL.c48
1 files changed, 43 insertions, 5 deletions
diff --git a/Source/3rdParty/SDL2/src/SDL.c b/Source/3rdParty/SDL2/src/SDL.c
index 0e55279..6d7e166 100644
--- a/Source/3rdParty/SDL2/src/SDL.c
+++ b/Source/3rdParty/SDL2/src/SDL.c
@@ -33,6 +33,7 @@
#include "events/SDL_events_c.h"
#include "haptic/SDL_haptic_c.h"
#include "joystick/SDL_joystick_c.h"
+#include "sensor/SDL_sensor_c.h"
/* Initialization/Cleanup routines */
#if !SDL_TIMERS_DISABLED
@@ -123,11 +124,11 @@ SDL_InitSubSystem(Uint32 flags)
}
#if SDL_VIDEO_DRIVER_WINDOWS
- if ((flags & (SDL_INIT_HAPTIC|SDL_INIT_JOYSTICK))) {
- if (SDL_HelperWindowCreate() < 0) {
- return -1;
- }
- }
+ if ((flags & (SDL_INIT_HAPTIC|SDL_INIT_JOYSTICK))) {
+ if (SDL_HelperWindowCreate() < 0) {
+ return -1;
+ }
+ }
#endif
#if !SDL_TIMERS_DISABLED
@@ -232,6 +233,20 @@ SDL_InitSubSystem(Uint32 flags)
#endif
}
+ /* Initialize the sensor subsystem */
+ if ((flags & SDL_INIT_SENSOR)){
+#if !SDL_SENSOR_DISABLED
+ if (SDL_PrivateShouldInitSubsystem(SDL_INIT_SENSOR)) {
+ if (SDL_SensorInit() < 0) {
+ return (-1);
+ }
+ }
+ SDL_PrivateSubsystemRefCountIncr(SDL_INIT_SENSOR);
+#else
+ return SDL_SetError("SDL not built with sensor support");
+#endif
+ }
+
return (0);
}
@@ -245,6 +260,15 @@ void
SDL_QuitSubSystem(Uint32 flags)
{
/* Shut down requested initialized subsystems */
+#if !SDL_SENSOR_DISABLED
+ if ((flags & SDL_INIT_SENSOR)) {
+ if (SDL_PrivateShouldQuitSubsystem(SDL_INIT_SENSOR)) {
+ SDL_SensorQuit();
+ }
+ SDL_PrivateSubsystemRefCountDecr(SDL_INIT_SENSOR);
+ }
+#endif
+
#if !SDL_JOYSTICK_DISABLED
if ((flags & SDL_INIT_GAMECONTROLLER)) {
/* game controller implies joystick */
@@ -451,6 +475,20 @@ SDL_GetPlatform()
#endif
}
+SDL_bool
+SDL_IsTablet()
+{
+#if __ANDROID__
+ extern SDL_bool SDL_IsAndroidTablet(void);
+ return SDL_IsAndroidTablet();
+#elif __IPHONEOS__
+ extern SDL_bool SDL_IsIPad(void);
+ return SDL_IsIPad();
+#else
+ return SDL_FALSE;
+#endif
+}
+
#if defined(__WIN32__)
#if (!defined(HAVE_LIBC) || defined(__WATCOMC__)) && !defined(SDL_STATIC_LIB)