Exemple #1
0
//--------------------------------------------------------------
void testApp::setup()
{
//	frameRate = 25;
	frameRate = 60;
	
	ofSetVerticalSync( true );
	ofSetFrameRate( frameRate );
	ofSetCircleResolution( 100 );
	
	screenGrab.setup( "movies/" );
//	screenGrab.setPause( false );
	
	tileSaver.init( 10, 0, true );
	
	bDebug		= false;
	bFullScreen	= false;
	bSmooth		= true;
	bDrawGhost	= true;
	bPause		= false;
	bUseCamera	= true;
	
	initColors();
	initCamera();
	initLogo();
	initCv();
	initContours();
	initBox2d();
	initOpticalField();
	initCirclePacker();
}
Exemple #2
0
void SmallWorld::setup() {
	
	bugs.resize(bugNum);
	genes.resize(bugNum);
	
	initialize();
	initBox2d();
}
Exemple #3
0
void Blobs02 :: setup()
{
	ofSetCircleResolution( 50 );
	
	initBox2d();
	initAudioIn();
	initGui();
	
	blobScale		= 100.0;
	blobNodeDaming	= 0.87;
	blobNodeEase	= 0.4;
}
Exemple #4
0
/*
	Game  - Constructor, this method begins the 
	construction and loading of all major game objects. 
	This method only needs to be called once, when the 
	application is first started.

	NOTE: This constructor will not initialize the custom
	game objects: graphics, input, os, & timer.
	These must be constructed separately and fed to this
	object using the init method. Doing it this way allows for
	more platform independence.
*/
Game::Game()
{
	// NOTE THAT graphics, input, os, & timer
	// ARE CUSTOM GAME OBJECTS. DEPENDING ON WHAT TECHNOLOGY 
	// IS TO BE USED THESE OBJECT SHOULD BE CONSTRUCTED
	// AND THEN FED TO THIS Game USING THE init METHOD
	initMusic();
	initBox2d();
	gsm = new GameStateManager();
	gui = new GameGUI();
	text = new GameText();
}
Exemple #5
0
void SmallWorld::update() {
	
	if (!finished) {
		
		if (bugs[0].isFinished()) {
			
			evaluate();
			
			bug1 = bugs[0];
			bug2 = bugs[1];
			
			// chech if termination is satisfied
			if (termination()) {
				
				cout << "end bugs life simulation up." << endl;
				finished = true;
				
			} else {
				// do crossover or mutation
				breed();
				
				// reproduction
				initBox2d();
			}
			
		} else {
			
			box2d.update();
			
			// add force every 0.5s
			if (steps > 0 && steps % 15 == 0) {
				
				for (int i = 0; i < bugs.size(); i++) {
					bugs[i].update();
				}
			}
			
			steps++;
		}
	}
}