Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'source/gameengine/GameLogic/Joystick/SCA_JoystickEvents.cpp')
-rw-r--r--source/gameengine/GameLogic/Joystick/SCA_JoystickEvents.cpp15
1 files changed, 14 insertions, 1 deletions
diff --git a/source/gameengine/GameLogic/Joystick/SCA_JoystickEvents.cpp b/source/gameengine/GameLogic/Joystick/SCA_JoystickEvents.cpp
index 2911b3b1a14..0033c137eb6 100644
--- a/source/gameengine/GameLogic/Joystick/SCA_JoystickEvents.cpp
+++ b/source/gameengine/GameLogic/Joystick/SCA_JoystickEvents.cpp
@@ -36,6 +36,9 @@
#include "SCA_Joystick.h"
#include "SCA_JoystickPrivate.h"
+#ifdef _MSC_VER
+# include <cstdio> /* printf */
+#endif
#ifdef WITH_SDL
void SCA_Joystick::OnAxisMotion(SDL_Event* sdl_event)
@@ -82,7 +85,11 @@ void SCA_Joystick::OnNothing(SDL_Event* sdl_event)
void SCA_Joystick::HandleEvents(void)
{
SDL_Event sdl_event;
-
+
+ if (SDL_PollEvent == (void*)0) {
+ return;
+ }
+
int i;
for (i=0; i<m_joynum; i++) { /* could use JOYINDEX_MAX but no reason to */
if (SCA_Joystick::m_instance[i])
@@ -117,6 +124,12 @@ void SCA_Joystick::HandleEvents(void)
SCA_Joystick::m_instance[sdl_event.jball.which]->OnBallMotion(&sdl_event);
break;
#endif
+#if SDL_VERSION_ATLEAST(2, 0, 0)
+ case SDL_JOYDEVICEADDED:
+ case SDL_JOYDEVICEREMOVED:
+ /* pass */
+ break;
+#endif
default:
printf("SCA_Joystick::HandleEvents, Unknown SDL event (%d), this should not happen\n", sdl_event.type);
break;