net.silentlycrashing.gestures
Class WiimoteGestureAnalyzer

java.lang.Object
  extended by net.silentlycrashing.gestures.GestureAnalyzer
      extended by net.silentlycrashing.gestures.WiimoteGestureAnalyzer

public class WiimoteGestureAnalyzer
extends GestureAnalyzer

Records gestures made using a Wii Remote for analysis.

Works using Andreas Schlegel's oscP5 and darwiinosc libraries.


Field Summary
static int A_BUTTON
           
static int B_BUTTON
           
private  boolean buttonPressed
           
private  Point currPoint
           
static int MAX_SIZE
           
private  oscP5.OscP5 oscClient
           
 
Fields inherited from class net.silentlycrashing.gestures.GestureAnalyzer
DOWN, KEY_SIZE, LEFT, p, RIGHT, UP
 
Constructor Summary
WiimoteGestureAnalyzer(PApplet parent)
          Builds a WiimoteGestureAnalyzer with default button, incoming port, and minimum offset.
WiimoteGestureAnalyzer(PApplet parent, int button)
          Builds a WiimoteGestureAnalyzer with default incoming port and minimum offset.
WiimoteGestureAnalyzer(PApplet parent, int button, int port)
          Builds a WiimoteGestureAnalyzer with default minimum offset.
WiimoteGestureAnalyzer(PApplet parent, int button, int port, int min)
          Builds a WiimoteGestureAnalyzer.
 
Method Summary
 void buttonEvent(int val)
          Handles a button event.
 void connectEvent(int val)
          Handles a connect event.
 void draw()
          Draws the current pointer position to the canvas.
 void drawPointer(boolean d)
          Sets whether the Wiimote pointer should be drawn or not.
 void irEvent(float x1, float y1, float s1, float x2, float y2, float s2, float x3, float y3, float s3, float x4, float y4, float s4)
          Handles an IR event.
 
Methods inherited from class net.silentlycrashing.gestures.GestureAnalyzer
getGesture, getMinOffset, invokeStartActions, invokeStopActions, invokeUpdateActions, isDebug, isRecognized, isVerbose, matches, registerStartAction, registerStopAction, registerUpdateAction, setDebug, setMinOffset, setVerbose, start, stop, update
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

A_BUTTON

public static final int A_BUTTON
See Also:
Constant Field Values

B_BUTTON

public static final int B_BUTTON
See Also:
Constant Field Values

MAX_SIZE

public static final int MAX_SIZE
See Also:
Constant Field Values

oscClient

private oscP5.OscP5 oscClient

currPoint

private Point currPoint

buttonPressed

private boolean buttonPressed
Constructor Detail

WiimoteGestureAnalyzer

public WiimoteGestureAnalyzer(PApplet parent)
Builds a WiimoteGestureAnalyzer with default button, incoming port, and minimum offset.

Parameters:
parent - the parent PApplet

WiimoteGestureAnalyzer

public WiimoteGestureAnalyzer(PApplet parent,
                              int button)
Builds a WiimoteGestureAnalyzer with default incoming port and minimum offset.

Parameters:
parent - the parent PApplet
button - the Wiimote button to check

WiimoteGestureAnalyzer

public WiimoteGestureAnalyzer(PApplet parent,
                              int button,
                              int port)
Builds a WiimoteGestureAnalyzer with default minimum offset.

Parameters:
parent - the parent PApplet
button - the Wiimote button to check
port - the incoming port for OSC messages

WiimoteGestureAnalyzer

public WiimoteGestureAnalyzer(PApplet parent,
                              int button,
                              int port,
                              int min)
Builds a WiimoteGestureAnalyzer.

Parameters:
parent - the parent PApplet
button - the Wiimote button to check
port - the incoming port for OSC messages
min - the minimum offset
Method Detail

connectEvent

public void connectEvent(int val)
Handles a connect event.

Parameters:
val - whether or not the Wiimote is connected

buttonEvent

public void buttonEvent(int val)
Handles a button event.

Parameters:
val - whether or not the button is pressed

irEvent

public void irEvent(float x1,
                    float y1,
                    float s1,
                    float x2,
                    float y2,
                    float s2,
                    float x3,
                    float y3,
                    float s3,
                    float x4,
                    float y4,
                    float s4)
Handles an IR event.

Parameters:
x1 - x-value of IR spot 1
y1 - y-value of IR spot 1
s1 - size of IR spot 1
x2 - x-value of IR spot 2
y2 - y-value of IR spot 2
s2 - size of IR spot 2
x3 - x-value of IR spot 3
y3 - y-value of IR spot 3
s3 - size of IR spot 3
x4 - x-value of IR spot 4
y4 - y-value of IR spot 4
s4 - size of IR spot 4

draw

public void draw()
Draws the current pointer position to the canvas.

Can be registered for automatic drawing using drawPointer().


drawPointer

public void drawPointer(boolean d)
Sets whether the Wiimote pointer should be drawn or not.

Parameters:
d - whether or not to draw the pointer