MinVR  0.9.0
A multi-platform virtual reality library
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
InputDeviceSpaceNav.H
Go to the documentation of this file.
1 //========================================================================
2 // MinVR
3 // Platform: Any
4 // API version: 1.0
5 //------------------------------------------------------------------------
6 // The MIT License (MIT)
7 //
8 // Copyright (c) 2013 Regents of the University of Minnesota
9 //
10 // Permission is hereby granted, free of charge, to any person obtaining a copy of
11 // this software and associated documentation files (the "Software"), to deal in
12 // the Software without restriction, including without limitation the rights to
13 // use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
14 // the Software, and to permit persons to whom the Software is furnished to do so,
15 // subject to the following conditions:
16 //
17 // The above copyright notice and this permission notice shall be included in all
18 // copies or substantial portions of the Software.
19 //
20 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
21 // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
22 // FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
23 // COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
24 // IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
25 // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
26 //========================================================================
27 
44 #ifndef SPACENAVDEV_H
45 #define SPACENAVDEV_H
46 
47 #include <glm/glm.hpp>
49 #include "MVRCore/ConfigMap.H"
50 #include "MVRCore/Event.H"
51 #include <vector>
52 #include <boost/log/trivial.hpp>
53 
54 #define BOOST_ASSERT_MSG_OSTREAM std::cout
55 #include <boost/assert.hpp>
56 
57 
58 namespace MinVR {
59 
61 {
62 public:
63 
64 #ifdef USE_SPACENAV
65  InputDeviceSpaceNav( const std::string name, const ConfigMapRef map = NULL )
66  {
67  BOOST_LOG_TRIVIAL(info) << "Creating new SpaceNavDevice";
68  setup();
69  }
70 
71  void setup();
72 
73  virtual ~InputDeviceSpaceNav();
74 
75  void pollForInput(std::vector<EventRef> &events);
76 
77 private:
78  bool connected;
79 
80 #else
81  InputDeviceSpaceNav(const std::string name, const ConfigMapRef map = NULL)
82  {
83  BOOST_ASSERT_MSG(false, "Spacenav is currently unsupported. Set cmake option USE_SPACENAV to ON and recompile.");
84  }
85 
86  virtual ~InputDeviceSpaceNav() {}
87  void pollForInput(std::vector<EventRef> &events) {}
88 
89 #endif // USE_SPACENAV
90 };
91 
92 } // end namespace
93 
94 #endif // SPACENAVDEV_H