net.silentlycrashing.gestures
Class ConcurrentGestureListener

java.lang.Object
  extended by net.silentlycrashing.gestures.GestureListener
      extended by net.silentlycrashing.gestures.ConcurrentGestureListener
Direct Known Subclasses:
ConcurrentCCWTwirlListener, ConcurrentCWTwirlListener, ConcurrentHShakeListener, ConcurrentVShakeListener

public class ConcurrentGestureListener
extends GestureListener

Listens for a matching gesture while the movement is being made.


Field Summary
protected  String activePattern
           
 
Fields inherited from class net.silentlycrashing.gestures.GestureListener
active, bounds, ga, inBounds, offAction, onAction, p, startPoint
 
Constructor Summary
ConcurrentGestureListener(PApplet parent, GestureAnalyzer analyzer, String pattern)
          Builds a ConcurrentGestureListener covering the entire canvas.
ConcurrentGestureListener(PApplet parent, GestureAnalyzer analyzer, String pattern, int x, int y, int w, int h)
          Builds a bounded ConcurrentGestureListener.
ConcurrentGestureListener(PApplet parent, GestureAnalyzer analyzer, String pattern, Rectangle bounds)
          Builds a bounded ConcurrentGestureListener.
 
Method Summary
 void keepListening(PointInTime pt)
          Checks if the regex pattern is matched and sets the Listener as active or not.
 void stopListening(PointInTime pt)
          Resets the Listener.
 
Methods inherited from class net.silentlycrashing.gestures.GestureListener
activate, deactivate, getStartPoint, isActive, registerOffAction, registerOnAction, setBounds, startListening
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

activePattern

protected String activePattern
Constructor Detail

ConcurrentGestureListener

public ConcurrentGestureListener(PApplet parent,
                                 GestureAnalyzer analyzer,
                                 String pattern)
Builds a ConcurrentGestureListener covering the entire canvas.

Parameters:
parent - the parent PApplet
analyzer - the linked GestureAnalyzer
pattern - the move pattern to match for the Listener to be active

ConcurrentGestureListener

public ConcurrentGestureListener(PApplet parent,
                                 GestureAnalyzer analyzer,
                                 String pattern,
                                 int x,
                                 int y,
                                 int w,
                                 int h)
Builds a bounded ConcurrentGestureListener.

Parameters:
parent - the parent PApplet
analyzer - the linked GestureAnalyzer
pattern - the move pattern to match for the Listener to be active
x - the x-coordinate of the bounding Rectangle
y - the y-coordinate of the bounding Rectangle
w - the width of the bounding Rectangle
h - the height of the bounding Rectangle

ConcurrentGestureListener

public ConcurrentGestureListener(PApplet parent,
                                 GestureAnalyzer analyzer,
                                 String pattern,
                                 Rectangle bounds)
Builds a bounded ConcurrentGestureListener.

Parameters:
parent - the parent PApplet
analyzer - the linked GestureAnalyzer
pattern - the move pattern to match for the Listener to be active
bounds - the bounding Rectangle
Method Detail

keepListening

public void keepListening(PointInTime pt)
Checks if the regex pattern is matched and sets the Listener as active or not.

Specified by:
keepListening in class GestureListener
Parameters:
pt - the current PointInTime of the gesture

stopListening

public void stopListening(PointInTime pt)
Resets the Listener.

Specified by:
stopListening in class GestureListener
Parameters:
pt - the last PointInTime of the gesture