GAME ON 2010
Control Inputs & Canvas Outputs
Paul Truong - Creative Technologist, Google ~ Dec 2010


//game setup - runs once
void setup() {
//easy setup
size(windowWidth, windowHeight);
frameRate(40);
//easy load of images
PImage hero;
hero = loadImage("gmail.png");
}
//running of game - automatic
void draw() {
//easy display of images
image(hero, heroX, heroY);
}
//inputs - easy detection
void keyPressed() {
//detection of key presses
if (key == 32) {
laser();
}
}
//listen for orientation events
window.addEventListener("deviceorientation", captureOrientation, false);
//do something with the alpha, beta and gamma properties of the event
function captureOrientation(e) {
//properties of the event
alpha = e.alpha;
beta = e.beta;
gamma = e.gamma;
}
<!-- speech input -->
<input type="text" speech="true" />