katerlib
Class KaterKontrol

java.lang.Object
  extended by katerlib.KaterKontrol
All Implemented Interfaces:
IKaterEventListener

public class KaterKontrol
extends java.lang.Object
implements IKaterEventListener


Field Summary
static java.lang.String VERSION
           
 
Constructor Summary
KaterKontrol(processing.core.PApplet theParent, TuioProcessing tuioClient, int[] katerTuioIds)
          The KaterKontrol Constructor which needs a Reference to PApplet, TUIO and an array with Fiducial IDs
 
Method Summary
 void dispose()
          Should only called by Processing.
 void draw()
          Kater will be drawn in the Processing Draw Cycle
 java.lang.Boolean getDebug()
           
 Kater getKaterById(int katerId)
          Returns a Kater Object by its Fiducial ID
 void KaterGoTo(Kater kater, float theX, float theY)
          send a Kater by its Object to a Coordinate
 void KaterIdGoTo(int katerId, float theX, float theY)
          send a Kater by its Fiducial ID to a Coordinate
 void keyEvent(java.awt.event.KeyEvent e)
           
 void onActionStateChange(IKaterEventDispatcher dispatcher, EKaterEventState theState)
           
 void pre()
          Kater will be update in the Processing Pre Cycle
 void setDebug(java.lang.Boolean debug)
           
 void toggleDebug()
           
static java.lang.String version()
          return the version of the library.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

VERSION

public static final java.lang.String VERSION
See Also:
Constant Field Values
Constructor Detail

KaterKontrol

public KaterKontrol(processing.core.PApplet theParent,
                    TuioProcessing tuioClient,
                    int[] katerTuioIds)
The KaterKontrol Constructor which needs a Reference to PApplet, TUIO and an array with Fiducial IDs

Parameters:
theParent - Reference to the PApplet (usually this)
tuioClient - Reference to the TUIOProcessing Client
katerTuioIds - An Array of ints with the Fiducial IDs
+Example
import katerlib.*;
import TUIO.*;

KaterKontrol katerkontrol;
TuioProcessing tuioClient;
int[] katerIDs = {8,9};

void setup() {
  size(800,600);
  tuioClient= new TuioProcessing(this);
  katerkontrol = new KaterKontrol(this, tuioClient, katerIDs);
  katerkontrol.KaterIdGoTo(8,400,300);
}
void draw() {
  background(125);
}

// these callback methods are called whenever a TUIO event occurs

// called when an object is added to the scene
void addTuioObject(TuioObject tobj) {
//  println("add object "+tobj.getSymbolID()+" ("+tobj.getSessionID()+") "+tobj.getX()+" "+tobj.getY()+" "+tobj.getAngle());
}

// called when an object is removed from the scene
void removeTuioObject(TuioObject tobj) {
//  println("remove object "+tobj.getSymbolID()+" ("+tobj.getSessionID()+")");
}

// called when an object is moved
void updateTuioObject (TuioObject tobj) {
//  println("update object "+tobj.getSymbolID()+" ("+tobj.getSessionID()+") "+tobj.getX()+" "+tobj.getY()+" "+tobj.getAngle()+" "+tobj.getMotionSpeed()+" "+tobj.getRotationSpeed()+" "+tobj.getMotionAccel()+" "+tobj.getRotationAccel());
}

// called when a cursor is added to the scene
void addTuioCursor(TuioCursor tcur) {
//  println("add cursor "+tcur.getCursorID()+" ("+tcur.getSessionID()+ ") " +tcur.getX()+" "+tcur.getY());
}

// called when a cursor is moved
void updateTuioCursor (TuioCursor tcur) {
//  println("update cursor "+tcur.getCursorID()+" ("+tcur.getSessionID()+ ") " +tcur.getX()+" "+tcur.getY()+" "+tcur.getMotionSpeed()+" "+tcur.getMotionAccel());
}

// called when a cursor is removed from the scene
void removeTuioCursor(TuioCursor tcur) {
//  println("remove cursor "+tcur.getCursorID()+" ("+tcur.getSessionID()+")");
}

// called when a Kater has started
void katerStarted( Kater k ){
  println("Kater with id "+k.getID()+" has started");
}

// called when a Kater has finished
void katerFinished( Kater k ){
  println("Kater with id "+k.getID()+" has finished");
}

// called after each message bundle
// representing the end of an image frame
void refresh(TuioTime bundleTime) { 
  redraw();
}
Method Detail

pre

public void pre()
Kater will be update in the Processing Pre Cycle


draw

public void draw()
Kater will be drawn in the Processing Draw Cycle


KaterGoTo

public void KaterGoTo(Kater kater,
                      float theX,
                      float theY)
send a Kater by its Object to a Coordinate

Parameters:
kater - Reference to the Kater Object
theX - X Coordinate
theY - Y Coordinate

KaterIdGoTo

public void KaterIdGoTo(int katerId,
                        float theX,
                        float theY)
send a Kater by its Fiducial ID to a Coordinate

Parameters:
katerId - Fiducial ID of the Kater
theX - X Coordinate
theY - Y Coordinate

getKaterById

public Kater getKaterById(int katerId)
Returns a Kater Object by its Fiducial ID

Parameters:
katerId - Fiducial ID of the Kater
Returns:
the Kater Object

onActionStateChange

public void onActionStateChange(IKaterEventDispatcher dispatcher,
                                EKaterEventState theState)
Specified by:
onActionStateChange in interface IKaterEventListener

version

public static java.lang.String version()
return the version of the library.

Returns:
String Version of the Library

dispose

public void dispose()
Should only called by Processing. Empties the Vectors and end connections to Processing and TUIO


keyEvent

public void keyEvent(java.awt.event.KeyEvent e)
Parameters:
e - the KeyEvent from @myParent

getDebug

public java.lang.Boolean getDebug()

setDebug

public void setDebug(java.lang.Boolean debug)

toggleDebug

public void toggleDebug()


processing library ktrLib by Christoph Steinlehner. (c) 2011