Commands

// Be sure to click the applet so it knows about your keyboard 
 
import compose.commands.*; 

Commands commands; 
 
void setup() { 
  commands = new Commands(this); 
  commands.add("drawEllipse", 'd'); 
  commands.add("drawRect", CONTROL, 'd'); 
} 
 
// You must add draw, or Command won't receive key events! 
void draw() { } 
 
void drawEllipse() { 
  ellipse(random(width), random(height), 10, 10); 
} 
 
void drawRect() { 
  rect(random(width), random(height), 20, 20); 
} 

This browser does not have a Java Plug-in.
Get the latest Java Plug-in here.

Description

Command objects store the relationships between keys and functions.

Methods
add()
Ties a key or keystroke to a function
compatibilityMode()
"Flattens" certain pairs of keystrokes for cross platform compatibility.
Constructors
new Commands(PApplet)
Related
    Last Modified: January 18, 2010

    No Comments

    You must be logged in to post a comment.