Open a2hill opened 9 years ago
hi @a2hill yes i think this would be a great addition. originally all i did was fork theo's ofxLeapMotion and adapt it for the newer leap libraries which supported hand skeleton tracking (and finger identification). i didn't make any updates for the gestures.
@a2hill - did you end up adding gestures? Any chance you could share that file? Thanks, Rachel
@rachelmax Honestly I'm not sure. I have this patch that I created a number of years ago, you might give it a shot but its been so long since I've worked on this that I don't really remember. Hope it helps! add_gesture_events.txt
@a2hill - thanks for the file! I'll give it a shot.
I'm using your addon in my project and I noticed there are quite a few stubs for gesture support. Since I need gestures for my project I'm going to be implementing some gesture functionality and I was going to submit a pull request when I'm done. Do you have any input on how I go about doing this?
My current plan of action is to add
ofEvents
toofxLeapMotion
and haveupdateGestures
callofNotifyEvent
on each respective event (onSwipeUp onSwipeDown, etc).To make listeners easy to implement I was going to outline a small class,
ofxLeapGestureListener
, which can be inherited by a user'sofApp
class.ofxLeapGestureListener
will provide stub methods (onSwipeUp onSwipeDown, etc) that do nothing for each action. Since the methods are not virtual, the user only needs to reimplement the event handler methods (in theirofApp
class) for the gestures they care about. This is similar to howonKeyPressed
,onMouseEvent
, etc. are all currently handled.To make attaching listeners easy I was going to add a method:
setupGestures(ofxLeapGestureListener * listener)
which calls
ofAddListener
for each event handler implemented inofxLeapGestureListener
and then calls the actualsetupGestures()
method.Implemented this way, there would only be one line added (in addition to overriding any "onGestureEvent" methods) to the user's
ofApp.cpp
:leapController.setupGestures(this);
Any thoughts on this?