Showing the changes to interface/src/scripting/JoystickScriptingInterface.cpp (1 of 2 files). Show all
Unified · Split
| @@ -78,6 +78,19 @@ const QObjectList JoystickScriptingInterface::getAllJoysticks() const { · 77 unmodified lines | ||
| 78 | 78 | return objectList; |
| 79 | 79 | } |
| 80 | 80 | |
| 81 | +Joystick* JoystickScriptingInterface::joystickWithName(const QString& name) { | |
| 82 | +#ifdef HAVE_SDL2 | |
| 83 | + QMap<SDL_JoystickID, Joystick*>::iterator iter = _openJoysticks.begin(); | |
| 84 | + while (iter != _openJoysticks.end()) { | |
| 85 | + if (iter.value()->getName() == name) { | |
| 86 | + return iter.value(); | |
| 87 | + } | |
| 88 | + iter++; | |
| 89 | + } | |
| 90 | +#endif | |
| 91 | + return NULL; | |
| 92 | +} | |
| 93 | + | |
| 81 | 94 | void JoystickScriptingInterface::update() { |
| 82 | 95 | #ifdef HAVE_SDL2 |
| 83 | 96 | if (_isInitialized) { |
| @@ -111,15 +124,3 @@ void JoystickScriptingInterface::update() { · 27 unmodified lines | ||
| 111 | 124 | } |
| 112 | 125 | #endif |
| 113 | 126 | } |
| 114 | − | |
| 115 | −#ifdef HAVE_SDL2 | |
| 116 | − | |
| 117 | −SDL_Joystick* JoystickScriptingInterface::openSDLJoystickWithName(const QString& name) { | |
| 118 | − // we haven't opened a joystick with this name yet - enumerate our SDL devices and see if it exists | |
| 119 | − int joystickCount = SDL_NumJoysticks(); | |
| 120 | − | |
| 121 | − | |
| 122 | − return NULL; | |
| 123 | −} | |
| 124 | − | |
| 125 | −#endif | |