-
Notifications
You must be signed in to change notification settings - Fork 14
/
Copy pathGestures.cpp
119 lines (119 loc) · 3.5 KB
/
Gestures.cpp
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
//#include "Gestures.h"
//
//using namespace Leap;
//using namespace LeapOsvr;
//
//
//////////////////////////////////////////////////////////////////////////////////////////////////////////
///*----------------------------------------------------------------------------------------------------*/
//Gestures::Gestures(const osvr::pluginkit::DeviceToken& pDeviceToken,
// OSVR_DeviceInitOptions pOptions, const LeapData& pLeapData) :
// mDeviceToken(pDeviceToken), mLeapData(pLeapData)/*,mGestureInterface(NULL)*/ {
// //osvrDeviceGestureConfig(pOptions, &mGestureInterface, 4);
//}
//
//
//////////////////////////////////////////////////////////////////////////////////////////////////////////
///*----------------------------------------------------------------------------------------------------*/
//void Gestures::update() {
// Frame frame = mLeapData.getFrame();
// GestureList gestures = frame.gestures();
// int gestureCount = gestures.count();
//
// for ( int i = 0 ; i < gestureCount ; i++ ) {
// sendGesture(gestures[i]);
// }
//}
//
//
//////////////////////////////////////////////////////////////////////////////////////////////////////////
///*----------------------------------------------------------------------------------------------------*/
//void Gestures::sendGesture(const Gesture& pGesture) {
// if ( !pGesture.isValid() ) {
// return;
// }
//
// Gesture::Type type = pGesture.type();
// Gesture::State state = pGesture.state();
// int64_t duration = pGesture.duration();
//
// Leap::Vector position;
// Leap::Vector direction;
// float progress = 0;
// float speed = 0;
// float radius = 0;
// std::string typeKey;
// std::string stateName;
//
// ////
//
// if ( type == Gesture::TYPE_CIRCLE ) {
// CircleGesture circle = (CircleGesture)pGesture;
// position = circle.center();
// progress = circle.progress();
// radius = circle.radius();
// typeKey = GestureKey::Circle;
// }
// else if ( type == Gesture::TYPE_SWIPE ) {
// SwipeGesture swipe = (SwipeGesture)pGesture;
// position = swipe.startPosition();
// direction = swipe.direction();
// speed = swipe.speed();
// typeKey = GestureKey::Swipe;
// }
// else if ( type == Gesture::TYPE_KEY_TAP ) {
// KeyTapGesture keyTap = (KeyTapGesture)pGesture;
// position = keyTap.position();
// direction = keyTap.direction();
// progress = keyTap.progress();
// typeKey = GestureKey::KeyTap;
// }
// else if ( type == Gesture::TYPE_SCREEN_TAP ) {
// ScreenTapGesture screenTap = (ScreenTapGesture)pGesture;
// position = screenTap.position();
// direction = screenTap.direction();
// progress = screenTap.progress();
// typeKey = GestureKey::ScreenTap;
// }
// else {
// std::cout << "[LEAP] Unsupported gesture type: " << type << std::endl;
// return;
// }
//
// ////
//
// switch ( state ) {
// case Gesture::STATE_INVALID:
// stateName = "Invalid";
// break;
//
// case Gesture::STATE_START:
// stateName = "Start";
// break;
//
// case Gesture::STATE_UPDATE:
// stateName = "Update";
// break;
//
// case Gesture::STATE_STOP:
// stateName = "Stop";
// break;
//
// default:
// std::cout << "[LEAP] Unsupported state type: " << state << std::endl;
// return;
// }
//
// ////
//
// std::cout << "GESTURE MESSAGE" <<
// "\n - type: " << type << " (" << typeKey << ")" <<
// "\n - stat: " << state << " (" << stateName << ")" <<
// "\n - dura: " << duration <<
// "\n - pos: " << position <<
// "\n - dir: " << direction <<
// "\n - prog: " << progress <<
// "\n - radi: " << radius <<
// "\n - spd: " << speed <<
// "\n" << std::endl;
//}