-
Notifications
You must be signed in to change notification settings - Fork 0
/
leaplistener.cpp
60 lines (50 loc) · 1.76 KB
/
leaplistener.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
#include "leaplistener.h"
#define BLACK 0
#define RED 1
#define GREEN 2
#define YELLOW 3
#define BLUE 4
#define MAGENTA 5
#define CYAN 6
#define WHITE 7
LeapListener::LeapListener()
{
}
LeapListener::LeapListener(GLWindow *glWindow){
this->glWindow = glWindow;
}
void LeapListener::onInit(const Controller& controller) {
std::cout << "Initialized" << std::endl;
}
void LeapListener::onConnect(const Controller& controller) {
std::cout << "Connected" << std::endl;
controller.enableGesture(Gesture::TYPE_CIRCLE);
controller.enableGesture(Gesture::TYPE_KEY_TAP);
controller.enableGesture(Gesture::TYPE_SCREEN_TAP);
controller.enableGesture(Gesture::TYPE_SWIPE);
}
void LeapListener::onDisconnect(const Controller& controller) {
//Note: not dispatched when running in a debugger.
std::cout << "Disconnected" << std::endl;
}
void LeapListener::onExit(const Controller& controller) {
std::cout << "Exited" << std::endl;
}
void LeapListener::onFrame(const Controller& controller) {
// Get the most recent frame and report some basic information
const Frame frame = controller.frame();
/*std::cout << "Frame id: " << frame.id()
<< ", timestamp: " << frame.timestamp()
<< ", hands: " << frame.hands().count()
<< ", fingers: " << frame.fingers().count()
<< ", tools: " << frame.tools().count()
<< ", gestures: " << frame.gestures().count() << std::endl;
std::cout << "Framerate: " << frame.currentFramesPerSecond() << std::endl;*/
this->glWindow->LeapFrame = frame;
}
void LeapListener::onFocusGained(const Controller& controller) {
std::cout << "Focus Gained" << std::endl;
}
void LeapListener::onFocusLost(const Controller& controller) {
std::cout << "Focus Lost" << std::endl;
}