MinVR  0.9.0
A multi-platform virtual reality library
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
InputDeviceVRPNButton.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 
41 #ifndef VRPNBUTTONDEVICE_H
42 #define VRPNBUTTONDEVICE_H
43 
44 // Note: This include ordering is important, don't screw with it!
45 #include <glm/glm.hpp>
46 #include <vector>
47 #include <iostream>
48 
50 #include "MVRCore/ConfigMap.H"
51 
52 #include <boost/log/trivial.hpp>
53 #define BOOST_ASSERT_MSG_OSTREAM std::cout
54 #include <boost/assert.hpp>
55 
56 #ifdef USE_VRPN
57 class vrpn_Button_Remote;
58 #endif
59 
60 namespace MinVR {
61 
65 {
66 public:
67 #ifdef USE_VRPN
68  InputDeviceVRPNButton(const std::string &vrpnButtonDeviceName, const std::vector<std::string> &eventsToGenerate);
69  InputDeviceVRPNButton(const std::string name, const ConfigMapRef map);
70 
71  virtual ~InputDeviceVRPNButton();
72 
73  void pollForInput(std::vector<EventRef> &events);
74 
75  std::string getEventName(int buttonNumber);
76  void sendEvent(int buttonNumber, bool down);
77 
78 private:
79  vrpn_Button_Remote *_vrpnDevice;
80  std::vector<std::string> _eventNames;
81  std::vector<EventRef> _pendingEvents;
82 #else
83  InputDeviceVRPNButton(const std::string &vrpnButtonDeviceName, const std::vector<std::string> &eventsToGenerate)
84  {
85  BOOST_ASSERT_MSG(false, "VRPN is currently unsupported. Set cmake option USE_VRPN to ON and recompile.");
86  }
87  InputDeviceVRPNButton(const std::string name, const ConfigMapRef map)
88  {
89  BOOST_ASSERT_MSG(false, "VRPN is currently unsupported. Set cmake option USE_VRPN to ON and recompile.");
90  }
91 
93  void pollForInput(std::vector<EventRef> &events) {}
94 #endif // USE_VRPN defined
95 };
96 
97 } // end namespace
98 
99 #endif
100 
101 
102 
103