MinVR  0.9.0
A multi-platform virtual reality library
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
InputDeviceTUIOClient.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 
28 #ifndef MINVR_TUIOEVENTS_H
29 #define MINVR_TUIOEVENTS_H
30 
31 #include <glm/glm.hpp>
32 
33 #ifdef USE_TUIO
34 #include <TuioClient.h>
35 #endif
36 
37 
39 #include "MVRCore/ConfigMap.H"
40 #include "MVRCore/Event.H"
41 #include <vector>
42 #include <unordered_set>
43 
44 #define BOOST_ASSERT_MSG_OSTREAM std::cout
45 #include <boost/assert.hpp>
46 
47 
48 
49 #define TUIO_PORT 3333
50 
51 namespace MinVR {
52 
54 {
55 public:
56 
57 #ifdef USE_TUIO
58  InputDeviceTUIOClient(int port = TUIO_PORT, double xScaleFactor = 1.0, double yScaleFactor=1.0 );
59  InputDeviceTUIOClient( const std::string name, const ConfigMapRef map );
60  virtual ~InputDeviceTUIOClient();
61 
62  void pollForInput( std::vector<EventRef> &events );
63 
64 
65 private:
66  TUIO::TuioClient *_tuioClient;
67  std::unordered_set<int> _cursorsDown;
68  double _xScale;
69  double _yScale;
70 
71 #else
72  InputDeviceTUIOClient(int port = TUIO_PORT, double xScaleFactor = 1.0, double yScaleFactor=1.0 )
73  {
74  BOOST_ASSERT_MSG(false, "TUIO is currently unsupported. Set cmake option USE_TUIO to ON and recompile.");
75  }
76 
77  InputDeviceTUIOClient( const std::string name, const ConfigMapRef map )
78  {
79  BOOST_ASSERT_MSG(false, "TUIO is currently unsupported. Set cmake option USE_TUIO to ON and recompile.");
80  }
81 
83  void pollForInput( std::vector<EventRef> &events) {}
84 
85 
86 #endif // USE_TUIO
87 };
88 
89 } // end namespace
90 
91 #endif