TUIO Scol plugin
sTuio.h
1 /*
2 -----------------------------------------------------------------------------
3 This source file is part of OpenSpace3D
4 For the latest info, see http://www.openspace3d.com
5 
6 Copyright (c) 2012 I-maginer
7 
8 This program is free software; you can redistribute it and/or modify it under
9 the terms of the GNU Lesser General Public License as published by the Free Software
10 Foundation; either version 2 of the License, or (at your option) any later
11 version.
12 
13 This program is distributed in the hope that it will be useful, but WITHOUT
14 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
15 FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
16 
17 You should have received a copy of the GNU Lesser General Public License along with
18 this program; if not, write to the Free Software Foundation, Inc., 59 Temple
19 Place - Suite 330, Boston, MA 02111-1307, USA, or go to
20 http://www.gnu.org/copyleft/lesser.txt
21 
22 -----------------------------------------------------------------------------
23 */
24 
25 #ifndef S_TUIO_H
26 #define S_TUIO_H
27 
28 // Include c++ string header
29 #include <string>
30 #include <vector>
31 #include "TUIO/TuioClient.h"
32 #include <scolPlugin.h>
33 
34 static ScolWindowHandle HScol;
35 
39 class SCbData
40 {
41 public:
42  int id;
43  float x;
44  float y;
45  float ang;
46  float xvel;
47  float yvel;
48  float angvel;
49 protected:
50 private:
51 
52 public:
53  SCbData()
54  {
55  id = 0;
56  x = 0.0f;
57  y = 0.0f;
58  ang = 0.0f;
59  xvel = 0.0f;
60  yvel = 0.0f;
61  angvel = 0.0f;
62  };
63 
64  SCbData(int cid, float cx, float cy, float cang, float cxvel, float cyvel, float cangvel)
65  {
66  id = cid;
67  x = cx;
68  y = cy;
69  ang = cang;
70  xvel = cxvel;
71  yvel = cyvel;
72  angvel = cangvel;
73  };
74 
75  SCbData(int cid, float cx, float cy, float cxvel, float cyvel)
76  {
77  id = cid;
78  x = cx;
79  y = cy;
80  ang = 0.0f;
81  xvel = cxvel;
82  yvel = cyvel;
83  angvel = 0.0f;
84  };
85 
86  ~SCbData()
87  {
88  };
89 protected:
90 private:
91 };
92 
96 class STuioClient : public TUIO::TuioListener
97 {
98 public:
99 protected:
100  bool m_terminate;
101 private:
102  TUIO::TuioClient* m_tuioClient;
103  int m_port;
104 public:
108  STuioClient(int port);
109 
113  ~STuioClient();
114 
118  bool Connect();
119 
123  void Disconnect();
124 
128  bool IsConnected();
129 
130 protected:
131 private:
135  void addTuioObject(TUIO::TuioObject *tobj);
136  void updateTuioObject(TUIO::TuioObject *tobj);
137  void removeTuioObject(TUIO::TuioObject *tobj);
138 
139  void addTuioCursor(TUIO::TuioCursor *tcur);
140  void updateTuioCursor(TUIO::TuioCursor *tcur);
141  void removeTuioCursor(TUIO::TuioCursor *tcur);
142 
143  void addTuioBlob(TUIO::TuioBlob *tblb);
144  void updateTuioBlob(TUIO::TuioBlob *tblb);
145  void removeTuioBlob(TUIO::TuioBlob *tblb);
146 
147  void refresh(TUIO::TuioTime frameTime);
148 };
149 
150 #endif
Definition: sTuio.h:39