-
Notifications
You must be signed in to change notification settings - Fork 1
/
TuioToWinTab.h
172 lines (143 loc) · 5.61 KB
/
TuioToWinTab.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
/*
TUIO C++ Example - part of the reacTIVision project
http://reactivision.sourceforge.net/
Copyright (c) 2005-2016 Martin Kaltenbrunner <[email protected]>
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files
(the "Software"), to deal in the Software without restriction,
including without limitation the rights to use, copy, modify, merge,
publish, distribute, sublicense, and/or sell copies of the Software,
and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
Any person wishing to distribute modifications to the Software is
requested to send the modifications to the original developer so that
they can be incorporated into the canonical version.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR
ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
/*------------------------------------------------------------------------------
WintabEmulator - Emulation.h
Copyright (c) 2013 Carl G. Ritson <[email protected]>
This file may be freely used, copied, or distributed without compensation
or licensing restrictions, but is done so without any warranty or implication
of merchantability or fitness for any particular purpose.
------------------------------------------------------------------------------*/
#pragma once
#ifndef INCLUDED_TuioToWinTab_H
#define INCLUDED_TuioToWinTab_H
#include "wintab.h"
#define CSR_NAME_PUCK WTI_CURSORS+0
#define CSR_NAME_PRESSURE_STYLUS WTI_CURSORS+1
#define CSR_NAME_ERASER WTI_CURSORS+2
#define WTI_DDCTX_1 WTI_DDCTXS+1
#define WTI_DDCTX_2 WTI_DDCTXS+2
#define MAX_CONTEXTS 32
#define WTI_VIRTUAL_DEVICE 99
#include "TuioListener.h"
#include "TuioClient.h"
#include "UdpReceiver.h"
#include "TcpReceiver.h"
#include <math.h>
#include <vector>
#include <algorithm>
using namespace TUIO;
class TuioToWinTab : public TuioListener {
public:
void addTuioObject(TuioObject *tobj);
void updateTuioObject(TuioObject *tobj);
void removeTuioObject(TuioObject *tobj);
void addTuioCursor(TuioCursor *tcur);
void updateTuioCursor(TuioCursor *tcur);
void removeTuioCursor(TuioCursor *tcur);
void addTuioBlob(TuioBlob *tblb);
void updateTuioBlob(TuioBlob *tblb);
void removeTuioBlob(TuioBlob *tblb);
void refresh(TuioTime frameTime);
};
// EX EMULATIOn.cpp
typedef struct _emu_settings_t {
//switches
UINT tuio_udp;
UINT tuio_tcp;
int logging;
int tuio_mouse;
int tuio_buttons;
//IO
std::string log_file;
UINT tuio_udp_port;
std::string tuio_udp_address;
UINT tuio_tcp_port;
std::string tuio_tcp_address;
//Metrics
int screen_width;
int screen_height;
float tuio_x;
float tuio_y;
float tuio_w;
float tuio_h;
UINT wintab_x;
UINT wintab_y;
UINT wintab_w;
UINT wintab_h;
UINT mouse_x;
UINT mouse_y;
UINT mouse_w;
UINT mouse_h;
//these are set in stone, but it doesn't hurt to include those here
UINT tablet_height;
UINT tablet_width;
UINT32 pressure_max;
UINT32 pressure_min;
UINT32 pressure_contact;
//these are leftovers from parts of the other project and I'm not sure if these are even needed
BOOL disableFeedback;
BOOL disableGestures;
INT shiftX;
INT shiftY;
BOOL pressureExpand;
UINT pressureMin;
UINT pressureMax;
BOOL pressureCurve;
UINT pressurePoint[5];
UINT pressureValue[5];
} emu_settings_t;
void emuSetModule(HMODULE hModule);
void emuEnableThread(DWORD dwThread);
void emuDisableThread(DWORD dwThread);
void emuInit(BOOL fLogging, BOOL fDebug, emu_settings_t *settings);
void emuShutdown(void);
UINT emuWTInfoA(UINT wCategory, UINT nIndex, LPVOID lpOutput);
UINT emuWTInfoW(UINT wCategory, UINT nIndex, LPVOID lpOutput);
HCTX emuWTOpenA(HWND hWnd, LPLOGCONTEXTA lpLogCtx, BOOL fEnable);
HCTX emuWTOpenW(HWND hWnd, LPLOGCONTEXTW lpLogCtx, BOOL fEnable);
BOOL emuWTClose(HCTX hCtx);
int emuWTPacketsGet(HCTX hCtx, int cMaxPkts, LPVOID lpPkt);
BOOL emuWTPacket(HCTX hCtx, UINT wSerial, LPVOID lpPkt);
BOOL emuWTEnable(HCTX hCtx, BOOL fEnable);
BOOL emuWTOverlap(HCTX hCtx, BOOL fToTop);
BOOL emuWTConfig(HCTX hCtx, HWND hWnd);
BOOL emuWTGetA(HCTX hCtx, LPLOGCONTEXTA lpLogCtx);
BOOL emuWTGetW(HCTX hCtx, LPLOGCONTEXTW lpLogCtx);
BOOL emuWTSetA(HCTX hCtx, LPLOGCONTEXTA lpLogCtx);
BOOL emuWTSetW(HCTX hCtx, LPLOGCONTEXTW lpLogCtx);
BOOL emuWTExtGet(HCTX hCtx, UINT wExt, LPVOID lpData);
BOOL emuWTExtSet(HCTX hCtx, UINT wExt, LPVOID lpData);
BOOL emuWTSave(HCTX hCtx, LPVOID lpData);
HCTX emuWTRestore(HWND hWnd, LPVOID lpSaveInfo, BOOL fEnable);
int emuWTPacketsPeek(HCTX hCtx, int cMaxPkt, LPVOID lpPkts);
int emuWTDataGet(HCTX hCtx, UINT wBegin, UINT wEnd, int cMaxPkts, LPVOID lpPkts, LPINT lpNPkts);
int emuWTDataPeek(HCTX hCtx, UINT wBegin, UINT wEnd, int cMaxPkts, LPVOID lpPkts, LPINT lpNPkts);
int emuWTQueueSizeGet(HCTX hCtx);
BOOL emuWTQueueSizeSet(HCTX hCtx, int nPkts);
HMGR emuWTMgrOpen(HWND hWnd, UINT wMsgBase);
BOOL emuWTMgrClose(HMGR hMgr);
void setupReceiver(void);
static BOOL handleTuioMessage(TuioCursor *tcur, UINT32 pressure);
#endif /* INCLUDED_TuioToWinTab_H */