|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.ObjectcontrolP5.Controller
controlP5.Matrix
public class Matrix
A matrix is a 2d array with a pointer that traverses through the matrix in a timed interval. if an item of a matrix-column is active, the x and y position of the corresponding cell will trigger an event and notify the program. see the ControlP5matrix example for more information.
/**
* ControlP5 Matrix
*
* A matrix can be used for example as a sequencer, a drum machine.
*
* find a list of public methods available for the Matrix Controller
* at the bottom of this sketch.
*
* by Andreas Schlegel, 2012
* www.sojamo.de/libraries/controlp5
*
*/
import controlP5.*;
ControlP5 cp5;
Dong[][] d;
int nx = 10;
int ny = 10;
void setup() {
size(700, 400);
cp5 = new ControlP5(this);
cp5.addMatrix("myMatrix")
.setPosition(50, 100)
.setSize(200, 200)
.setGrid(nx, ny)
.setGap(10, 1)
.setInterval(200)
.setMode(ControlP5.MULTIPLES)
;
// use setMode to change the cell-activation which by
// default is ControlP5.SINGLE_ROW, 1 active cell per row,
// but can be changed to ControlP5.SINGLE_COLUMN or
// ControlP5.MULTIPLES
d = new Dong[nx][ny];
for(int x = 0;x
Field Summary |
---|
Fields inherited from class controlP5.Controller |
---|
autoHeight, autoSpacing, autoWidth |
Fields inherited from interface controlP5.ControlP5Constants |
---|
acceptClassList, ACTION_BROADCAST, ACTION_ENTER, ACTION_LEAVE, ACTION_PRESSED, ACTION_RELEASED, ACTION_RELEASEDOUTSIDE, ACTIVE, ALL, ALT, ARC, ARRAY, BACKSPACE, BASELINE, BITFONT, BOOLEAN, BOTTOM, BOTTOM_OUTSIDE, CAPTIONLABEL, CENTER, COMMANDKEY, CONTROL, controlEventClass, CUSTOM, DECREASE, DEFAULT, DELETE, DONE, DOWN, ELLIPSE, ENTER, ESCAPE, EVENT, eventMethod, FADEIN, FADEOUT, FIELD, FLOAT, HALF_PI, HIDE, HIGHLIGHT, HORIZONTAL, IDLE, IMAGE, INACTIVE, INCREASE, INTEGER, INVALID, KEYCONTROL, LEFT, LEFT_OUTSIDE, LINE, LOAD, MENU, METHOD, MOVE, MULTIPLES, OVER, PI, PRESSED, PRINT, RELEASE, RESET, RIGHT, RIGHT_OUTSIDE, SAVE, SHIFT, SINGLE, SINGLE_COLUMN, SINGLE_ROW, SPRITE, STRING, SWITCH, SWITCH_BACK, SWITCH_FORE, TAB, TOP, TOP_OUTSIDE, TRANSITION_WAIT_FADEIN, TWO_PI, UP, VALUELABEL, VERBOSE, VERTICAL, WAIT |
Constructor Summary | |
---|---|
Matrix(ControlP5 theControlP5,
ControllerGroup theParent,
java.lang.String theName,
int theCellX,
int theCellY,
int theX,
int theY,
int theWidth,
int theHeight)
|
Method Summary | |
---|---|
Matrix |
clear()
|
boolean |
get(int theX,
int theY)
|
int[][] |
getCells()
|
int |
getInterval()
|
int |
getMode()
|
static int |
getX(float thePosition)
|
static int |
getX(int thePosition)
|
static int |
getY(float thePosition)
|
static int |
getY(int thePosition)
|
void |
mousePressed()
|
void |
mouseReleased()
|
Matrix |
plugTo(java.lang.Object theObject)
|
Matrix |
plugTo(java.lang.Object theObject,
java.lang.String thePlugName)
|
void |
remove()
removes a controller from controlP5. |
Matrix |
set(int theX,
int theY,
boolean theValue)
set the state of a particular cell inside a matrix. |
Matrix |
setCells(int[][] theCells)
|
Matrix |
setGap(int theX,
int theY)
|
Matrix |
setGrid(int theCellX,
int theCellY)
|
Matrix |
setInterval(int theInterval)
set the speed of intervals in millis iterating through the matrix. |
Matrix |
setMode(int theMode)
use setMode to change the cell-activation which by default is ControlP5.SINGLE_ROW, 1 active cell per row, but can be changed to ControlP5.SINGLE_COLUMN or ControlP5.MULTIPLES |
Matrix |
setValue(float theValue)
|
Matrix |
update()
updates the value of the controller without having to set the value explicitly. |
Matrix |
updateDisplayMode(int theMode)
|
Matrix |
updateInternalEvents(processing.core.PApplet theApplet)
a method for putting input events like e.g. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface controlP5.ControllerInterface |
---|
continuousUpdateEvents, draw, parent, setColorLabel, setColorValue, setLabel |
Methods inherited from interface controlP5.CDrawable |
---|
draw |
Constructor Detail |
---|
public Matrix(ControlP5 theControlP5, ControllerGroup theParent, java.lang.String theName, int theCellX, int theCellY, int theX, int theY, int theWidth, int theHeight)
Method Detail |
---|
public Matrix clear()
public boolean get(int theX, int theY)
public int[][] getCells()
public int getInterval()
public int getMode()
public static int getX(float thePosition)
public static int getX(int thePosition)
public static int getY(float thePosition)
public static int getY(int thePosition)
public void mousePressed()
public void mouseReleased()
public Matrix plugTo(java.lang.Object theObject)
plugTo
in class Controller
public Matrix plugTo(java.lang.Object theObject, java.lang.String thePlugName)
plugTo
in class Controller
public void remove()
Controller
remove
in interface ControllerInterface
remove
in class Controller
public Matrix set(int theX, int theY, boolean theValue)
theX
- theY
- theValue
-
public Matrix setCells(int[][] theCells)
public Matrix setGap(int theX, int theY)
public Matrix setGrid(int theCellX, int theCellY)
public Matrix setInterval(int theInterval)
theInterval
- int
public Matrix setMode(int theMode)
theMode
- return Matrixpublic Matrix setValue(float theValue)
setValue
in interface ControllerInterface
setValue
in class Controller
theValue
- floatpublic Matrix update()
Controller
update
in interface ControllerInterface
update
in class Controller
Controller.setUpdate(boolean)
,
Controller.isUpdate()
public Matrix updateDisplayMode(int theMode)
public Matrix updateInternalEvents(processing.core.PApplet theApplet)
ControllerInterface
updateInternalEvents
in interface ControllerInterface
updateInternalEvents
in class Controller
ControllerInterface.updateInternalEvents
|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |