/**
*
*
SpaceBoxes_by_spxl
*
* Version 1.2.1, 2009-01-24
*
* Original idea and code ased on Falling Box by takumi
* Flying through an asteroid field, kind of.
* Autopilot (no controls!)
* Keys:
*
* - [space] toggle paused
* - [a] auto mode (randomly toggles background)
* - [b] toggle background on/off, [n] next background image
* - [e] effect shot (2 seconds) on random channel (not master)
* - [E] effect toggle on random channel (not master)
* - [r] toggle regular/random block sizes
* - [s] toggle scene spin, [S] reset spin rate to zero
* - [t] toggle objects tumble
* - [w] toggle scene spin wobble
* - [LEFT] [RIGHT] [UP] [DOWN] change scene orientation (texture warps strangely with the P3D renderer, try OPENGL
* - [PGUP] [PGDOWN] adjust scene spin rate clockwise/anticlockwise
* - [HOME] [END] reset scene orientation
* - [,] [.] [/] halve, double, toggle speed adjustment
* - [<] [>] [/] slow down, speed up, reset speed adjustment
* - [1]..[8] random action on numbered channel ([`] for master)
* - SHIFT + [1]..[8] disable display of numbered channel ([~] for master)
*
*/
/*
* 2009-01-18 Version 1.1 by subpixel
* - Code tidy.
* - User controls: toggle spin, toggle tumble, scene orientation, timewarp.
*
* 2009-01-20 Version 1.2 by subpixel
* - Massive rewrite. Program broken into classes.
* - Concept of (control) channels introduced (including master channel).
* - draw() broken into draw() and update() parts.
* - Effect parametrs and sample effects.
* - Library of background images to cycle through.
* - User controls: random action on numbered (and master) channel,
* effect toggle on random channel, effect shot on random channel,
* cycle background images.
*/
//import processing.opengl.*; // Only need if you want to use OPENGL mode
Scene scene; // Everthing (well, almost) there is to know about the scene.
// ----------------------------------------------------------------------------
// Setup method
// ----------------------------------------------------------------------------
public void setup()
{
// size(screen.width, int(screen.height*0.5), OPENGL); // Fullscreen anyone? :o)
// size(800, 600, OPENGL);
size(720, 320, P3D); // Applet-friendly dimensions
frameRate(30);
String[] bgImages = new String[]
{
"bg1.jpg",
"bg2.jpg",
"bg3.jpg",
"bg3.jpg",
"bg4.jpg",
"bg5.jpg",
"bg6.jpg",
"bg7.jpg",
"bg8.jpg"
};
scene = new Scene(this, bgImages);
}
// ----------------------------------------------------------------------------
// Draw method
// ----------------------------------------------------------------------------
public void draw()
{
scene.update();
scene.draw();
}
// ----------------------------------------------------------------------------
// Handle keyboard input
// ----------------------------------------------------------------------------
void keyPressed()
{
scene.keyPressed();
}