net.silentlycrashing.gestures
Class PostGestureListener

java.lang.Object
  extended by net.silentlycrashing.gestures.GestureListener
      extended by net.silentlycrashing.gestures.PostGestureListener
Direct Known Subclasses:
PostCCWTwirlListener, PostCWTwirlListener, PostHShakeListener, PostVShakeListener

public class PostGestureListener
extends GestureListener

Listens for a matching gesture after the movement is completed.


Field Summary
protected  String activePattern
           
 
Fields inherited from class net.silentlycrashing.gestures.GestureListener
active, bounds, ga, inBounds, offAction, onAction, p, startPoint
 
Constructor Summary
PostGestureListener(PApplet parent, GestureAnalyzer analyzer, String pattern)
          Builds a PostGestureListener covering the entire canvas.
PostGestureListener(PApplet parent, GestureAnalyzer analyzer, String pattern, int x, int y, int w, int h)
          Builds a bounded PostGestureListener.
PostGestureListener(PApplet parent, GestureAnalyzer analyzer, String pattern, Rectangle bounds)
          Builds a bounded PostGestureListener.
 
Method Summary
 void keepListening(PointInTime pt)
          Does nothing.
 void reset()
          Resets the GesureListener.
 void startListening(PointInTime pt)
          Checks that the gesture is starting in the correct bounds and sets the start point.
 void stopListening(PointInTime pt)
          Checks if the regex pattern is matched and sets the Listener as active or not.
 
Methods inherited from class net.silentlycrashing.gestures.GestureListener
activate, deactivate, getStartPoint, isActive, registerOffAction, registerOnAction, setBounds
 
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

PostGestureListener

public PostGestureListener(PApplet parent,
                           GestureAnalyzer analyzer,
                           String pattern)
Builds a PostGestureListener 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

PostGestureListener

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

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

PostGestureListener

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

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

startListening

public void startListening(PointInTime pt)
Checks that the gesture is starting in the correct bounds and sets the start point.

Overrides:
startListening in class GestureListener
Parameters:
pt - the first PointInTime of the gesture

keepListening

public void keepListening(PointInTime pt)
Does nothing. This Listener waits until the gesture is complete to analyze it.

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

stopListening

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

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

reset

public void reset()
Resets the GesureListener.

The offAction should be calling this when it is complete.