controlP5
Class ControlWindowCanvas

java.lang.Object
  extended by controlP5.ControlWindowCanvas

public abstract class ControlWindowCanvas
extends java.lang.Object

use a controlWindowCanvas to draw your custom content into a control window. be warned, for now ControlWindowCanvas and ControlCanvas are EXPERIMENTAL and will undergo changes in the future!

+Example
import controlP5.*;

/**
 * ControlP5 canvas.
 * WARNING
 * ControlCanvas and ControlWindowCanvas are yet EXPERIMENTAL
 * and therefore will undergo changes in the future before being
 * fully functional!
 *
 * by andreas schlegel, 2009
 */


ControlP5 controlP5;
ControlWindow controlWindow;
ControlWindowCanvas cc;

// your controlWindowCanvas class
class MyCanvas extends ControlWindowCanvas {
  public void draw(PApplet theApplet) {
    theApplet.fill(random(255));
    theApplet.rect(theApplet.mouseX,10,100,100);
  }
}


void setup() {
  size(400,400);
  frameRate(30);
  controlP5 = new ControlP5(this);

  // create a control window.
  controlWindow = controlP5.addControlWindow("controlP5window",100,100,400,400,30);

  // for continuous update use ControlWindow.NORMAL  to update a control
  // window only when it is in focus, use ControlWindow.ECONOMIC
  // economic is the default update value.
  controlWindow.setUpdateMode(ControlWindow.NORMAL);


  // create a control window canvas and add it to
  // the control window from above.  
  cc = new MyCanvas();
  cc.pre(); // use cc.post(); to draw on top of the controllers.
  controlWindow.addCanvas(cc);

}


void controlEvent(ControlEvent theEvent) {
  println(theEvent.controller().id()+"  /  "+
    theEvent.controller()+"  /  "+
    theEvent.controller().value()
    );
}


void draw() {
  background(0);
}


Field Summary
static int POST
           
static int PRE
           
 
Constructor Summary
ControlWindowCanvas()
           
 
Method Summary
abstract  void draw(processing.core.PApplet theApplet)
          controlWindowCanvas is an abstract class and therefore needs to be extended by your class.
 int mode()
          get the drawing mode of a ControlWindowCanvas.
 void moveTo(ControlWindow theControlWindow)
          move a canvas to another controlWindow
 void post()
          set the drawing mode to POST.
 void pre()
          set the drawing mode to PRE.
 void setMode(int theMode)
           
 ControlWindow window()
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PRE

public static final int PRE
See Also:
Constant Field Values

POST

public static final int POST
See Also:
Constant Field Values
Constructor Detail

ControlWindowCanvas

public ControlWindowCanvas()
Method Detail

draw

public abstract void draw(processing.core.PApplet theApplet)
controlWindowCanvas is an abstract class and therefore needs to be extended by your class. draw(PApplet theApplet) is the only method that needs to be overwritten.


moveTo

public void moveTo(ControlWindow theControlWindow)
move a canvas to another controlWindow

Parameters:
theControlWindow -

mode

public final int mode()
get the drawing mode of a ControlWindowCanvas. this can be PRE or POST.

Returns:

pre

public final void pre()
set the drawing mode to PRE. PRE is the default.


post

public final void post()
set the drawing mode to POST.


setMode

public final void setMode(int theMode)
Parameters:
theMode -

window

public final ControlWindow window()


processing library controlP5 by Andreas Schlegel. (c) 2010