#include #include "../lib/Leap.h" using namespace Leap; //---- Start Public Functions ----// extern "C" void beginEventLoop(); extern "C" bool isControllerCreated(); extern "C" void endEventLoop(); extern "C" bool imageExists(); extern "C" int getImageHeight(); extern "C" int getImageWidth(); extern "C" int getImageBPP(); extern "C" const unsigned char *getImageLeft(); extern "C" const unsigned char *getImageRight(); //---- End Public Functions ----// //---- Start Globals ----// Controller *controller = nullptr; ImageList images; //---- End Globals ----// #include "listener.cc" //---- Start Public Function Impls ----// void beginEventLoop() { if (controller == nullptr) { // Create a controller controller = new Controller(); // Set device policy controller->setPolicyFlags(Controller::POLICY_IMAGES); // Set up event handling LeapEventListener listener; controller->addListener(listener); } } void endEventLoop() { // if (controller != nullptr) // { // delete controller; // } } bool isControllerCreated() { return controller != nullptr; } bool imageExists() { return images.count() == 2; } int getImageHeight() { return images[0].height(); } int getImageWidth() { return images[0].width(); } int getImageBPP() { return images[0].bytesPerPixel(); } const unsigned char *getImageLeft() { return images[0].data(); } const unsigned char *getImageRight() { return images[1].data(); } //---- End Public Function Impls ----//