History

Decouple Application and plugin definitions, cleanup container usage

Brad Davis committed 11 years ago

Commit 5515b9d1 parent a79095d43 files · +399 −370Browse files

Showing the changes to libraries/input-plugins/src/input-plugins/InputPlugin.cpp (1 of 43 files). Show all

Unified · Split

libraries/input-plugins/src/input-plugins/InputPlugin.cpp+29−1
@@ -8,4 +8,32 @@ · 7 unmodified lines
88 // Distributed under the Apache License, Version 2.0.
99 // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
1010 //
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+}