]> git.tdb.fi Git - libs/vr.git/blobdiff - source/system.cpp
Rename DisplayDevice to System
[libs/vr.git] / source / system.cpp
diff --git a/source/system.cpp b/source/system.cpp
new file mode 100644 (file)
index 0000000..436862e
--- /dev/null
@@ -0,0 +1,29 @@
+#include <msp/strings/format.h>
+#include "system.h"
+#ifdef WITH_OPENVR
+#include "openvr/openvrsystem.h"
+#endif
+#ifdef WITH_LIBOVR
+#include "ovr/oculusriftsystem.h"
+#endif
+
+using namespace std;
+
+namespace Msp {
+namespace VR {
+
+System *System::create(const string &type)
+{
+#ifdef WITH_OPENVR
+       if(type=="openvr")
+               return new OpenVRSystem;
+#endif
+#ifdef WITH_LIBOVR
+       if(type=="libovr")
+               return new OculusRiftSystem;
+#endif
+       throw invalid_argument(format("system '%s' not supported", type));
+}
+
+} // namespace VR
+} // namespace Msp