Showing the changes to libraries/input-plugins/src/input-plugins/InputPlugin.cpp (1 of 43 files). Show all
Unified · Split
| @@ -8,4 +8,32 @@ · 7 unmodified lines | |||
| 8 | // Distributed under the Apache License, Version 2.0. | 8 | // Distributed under the Apache License, Version 2.0. |
| 9 | // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html | 9 | // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html |
| 10 | // | 10 | // |
| 11 | #include "InputPlugin.h" | 11 | #include "InputPlugin.h" |
| 12 | |||
| 13 | #include <plugins/PluginManager.h> | ||
| 14 | |||
| 15 | #include "KeyboardMouseDevice.h" | ||
| 16 | #include "SDL2Manager.h" | ||
| 17 | #include "SixenseManager.h" | ||
| 18 | #include "ViveControllerManager.h" | ||
| 19 | |||
| 20 | // TODO migrate to a DLL model where plugins are discovered and loaded at runtime by the PluginManager class | ||
| 21 | InputPluginList getInputPlugins() { | ||
| 22 | InputPlugin* PLUGIN_POOL[] = { | ||
| 23 | new KeyboardMouseDevice(), | ||
| 24 | new SDL2Manager(), | ||
| 25 | new SixenseManager(), | ||
| 26 | new ViveControllerManager(), | ||
| 27 | nullptr | ||
| 28 | }; | ||
| 29 | |||
| 30 | InputPluginList result; | ||
| 31 | for (int i = 0; PLUGIN_POOL[i]; ++i) { | ||
| 32 | InputPlugin * plugin = PLUGIN_POOL[i]; | ||
| 33 | if (plugin->isSupported()) { | ||
| 34 | plugin->init(); | ||
| 35 | result.push_back(InputPluginPointer(plugin)); | ||
| 36 | } | ||
| 37 | } | ||
| 38 | return result; | ||
| 39 | } | ||