controlP5
Class Bang

java.lang.Object
  extended by controlP5.Controller
      extended by controlP5.Bang
All Implemented Interfaces:
CDrawable, ControllerInterface, ControlP5Constants

public class Bang
extends Controller

The Bang controller triggers an event when pressed. A bang can only be assigned to a function in your program but not to a field like other controllers. Bang extends superclass Controller, for a full documentation see the Controller reference.

+Example
/**
 * ControlP5 Bang
 * A bang triggers an event that can be received by a function named after the bang.
 * By default a bang is triggered when pressed, this can be changed to 'release' 
 * using theBang.setTriggerEvent(Bang.RELEASE).
 *
 * find a list of public methods available for the Bang Controller 
 * at the bottom of this sketch.
 *
 * by Andreas Schlegel, 2012
 * www.sojamo.de/libraries/controlp5
 * 
 */

import controlP5.*;

ControlP5 cp5;

int myColorBackground = color(0, 0, 0);

color[] col = new color[] {
  color(100), color(150), color(200), color(250)
};


void setup() {
  size(400, 600);
  noStroke();
  cp5 = new ControlP5(this);
  for (int i=0;i

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
 
Method Summary
 int getTriggerEvent()
           
 Bang setTriggerEvent(int theEventID)
          By default a bang is triggered when the mouse is pressed.
 Bang setValue(float theValue)
          Sets the value of the bang controller.
 
Methods inherited from class controlP5.Controller
add, addCallback, addListener, align, bringToFront, bringToFront, changeValue, getAbsolutePosition, getAddress, getArrayValue, getArrayValue, getBehavior, getCaptionLabel, getColor, getControllerPlugList, getControlWindow, getDecimalPrecision, getDefaultValue, getHeight, getId, getLabel, getMax, getMin, getName, getParent, getPickingColor, getPosition, getProperty, getProperty, getStringValue, getTab, getValue, getValueLabel, getWidth, getWindow, hide, init, isActive, isBroadcast, isInside, isLabelVisible, isListening, isLock, isMouseOver, isMousePressed, isMoveable, isUpdate, isVisible, keyEvent, linebreak, listen, listenerSize, lock, moveTo, moveTo, moveTo, moveTo, moveTo, moveTo, moveTo, moveTo, moveTo, plugTo, plugTo, plugTo, plugTo, registerProperty, registerProperty, registerTooltip, remove, remove, removeBehavior, removeCallback, removeCallback, removeListener, removeProperty, removeProperty, setAbsolutePosition, setAddress, setArrayValue, setArrayValue, setBehavior, setBroadcast, setCaptionLabel, setColor, setColorActive, setColorBackground, setColorCaptionLabel, setColorForeground, setColorValueLabel, setDecimalPrecision, setDefaultValue, setGroup, setGroup, setHeight, setId, setImage, setImage, setImages, setImages, setImages, setLabelVisible, setLock, setMax, setMin, setMouseOver, setMousePressed, setMoveable, setParent, setPosition, setPosition, setSize, setSize, setStringValue, setTab, setTab, setUpdate, setValueLabel, setView, setView, setVisible, setWidth, show, unlock, unplugFrom, unplugFrom, unregisterTooltip, update, updateAbsolutePosition, updateEvents, updateInternalEvents, updateSize
 
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
 

Method Detail

getTriggerEvent

public int getTriggerEvent()

setTriggerEvent

public Bang setTriggerEvent(int theEventID)
By default a bang is triggered when the mouse is pressed. use setTriggerEvent(Bang.PRESSED) or setTriggerEvent(Bang.RELEASE) to define the action for triggering a bang. currently only Bang.PRESSED and Bang.RELEASE are supported.

Parameters:
theEventID -
Returns:
Bang

setValue

public Bang setValue(float theValue)
Sets the value of the bang controller. since bang can be true or false, false=0 and true=1

Specified by:
setValue in interface ControllerInterface
Specified by:
setValue in class Controller
Parameters:
theValue - float
Returns:
Bang


processing library controlP5 by Andreas Schlegel. (c) 2012