History

Add joystickWithName for PrioVR

Ryan Huffman committed 12 years ago

Commit 42479b11 parent a24b5c22 files · +20 −20Browse files

Showing the changes to interface/src/scripting/JoystickScriptingInterface.cpp (1 of 2 files). Show all

Unified · Split

interface/src/scripting/JoystickScriptingInterface.cpp+13−12
@@ -78,6 +78,19 @@ const QObjectList JoystickScriptingInterface::getAllJoysticks() const { · 77 unmodified lines
78 return objectList;78 return objectList;
79}79}
80 80
81Joystick* 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
81void JoystickScriptingInterface::update() {94void JoystickScriptingInterface::update() {
82#ifdef HAVE_SDL295#ifdef HAVE_SDL2
83 if (_isInitialized) {96 if (_isInitialized) {
@@ -111,15 +124,3 @@ void JoystickScriptingInterface::update() { · 27 unmodified lines
111 }124 }
112#endif125#endif
113}126}
114
115#ifdef HAVE_SDL2
116
117SDL_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