cleanup Leapmotion initialization removes warning

about unused variable
This commit is contained in:
Andrew Meadows 2014-07-14 09:26:42 -07:00
parent 85bfcf0eea
commit 456a3c3739
3 changed files with 21 additions and 20 deletions

View file

@ -1722,7 +1722,7 @@ void Application::init() {
_faceplus.init();
_visage.init();
Leapmotion* leap = Leapmotion::create();
Leapmotion::init();
// fire off an immediate domain-server check in now that settings are loaded
NodeList::getInstance()->sendDomainServerCheckIn();

View file

@ -36,27 +36,26 @@ MotionTracker::Index evalJointIndex(bool isRightSide, int finger, int bone) {
}
}
Leapmotion* Leapmotion::create() {
// check that the Leapmotion hasn't been created yet
// static
void Leapmotion::init() {
DeviceTracker* device = DeviceTracker::getDevice(NAME);
if (!device) {
// create a new Leapmotion and register it
Leapmotion* leap = new Leapmotion();
DeviceTracker::registerDevice(NAME, leap);
}
}
// static
Leapmotion* Leapmotion::getInstance() {
DeviceTracker* device = DeviceTracker::getDevice(NAME);
if (!device) {
// create a new Leapmotion
Leapmotion* leap = new Leapmotion();
// register it
DeviceTracker::registerDevice(NAME, leap);
return leap;
}
else
{
Leapmotion* leap = dynamic_cast< Leapmotion* > (device);
if (leap) {
return leap;
}
return NULL;
// create a new Leapmotion and register it
device = new Leapmotion();
DeviceTracker::registerDevice(NAME, device);
}
return dynamic_cast< Leapmotion* > (device);
}
Leapmotion::Leapmotion() :

View file

@ -25,8 +25,10 @@ class Leapmotion : public MotionTracker {
public:
static const Name NAME;
static void init();
/// Leapmotion MotionTracker factory
static Leapmotion* create();
static Leapmotion* getInstance();
bool isActive() const { return _active; }