#include "testApp.h"


//--------------------------------------------------------------
void testApp::setup(){	 
	
	curModule = 0;
	
	// here is the trick, myModules is an array of 
	// baseModules, but these modules are extnesions
	
	myModules[0] = new titleModule();
	myModules[1] = new movieModule();
	myModules[2] = new titleModule();
	myModules[3] = new graphicsModule();
	myModules[4] = new titleModule();
	myModules[5] = new imageModule();
	myModules[6] = new titleModule();
	
	
	// set all of them up:
	for (int i = 0; i < NUM_MODULES; i++){
		myModules[i]->setup();
	}
	
	// when we want to call non-baseModule code, we can cast:
	
	((titleModule *)myModules[0])->setTitle("hi!\nfirst movie:");
	((titleModule *)myModules[2])->setTitle("now some graphics:");
	((titleModule *)myModules[4])->setTitle("an image:");
	((titleModule *)myModules[6])->setTitle("bye!");
	
	curModule = 0;
	
	
	
	ofBackground(255,255,255);
	
}

//--------------------------------------------------------------
void testApp::update(){
	myModules[curModule]->update();
}

//--------------------------------------------------------------
void testApp::draw(){
	myModules[curModule]->draw();
}

//--------------------------------------------------------------
void testApp::keyPressed  (int key){ 
	curModule ++;
	curModule %= NUM_MODULES;
}

//--------------------------------------------------------------
void testApp::keyReleased  (int key){ 
}

//--------------------------------------------------------------
void testApp::mouseMoved(int x, int y ){
}

//--------------------------------------------------------------
void testApp::mouseDragged(int x, int y, int button){
}

//--------------------------------------------------------------
void testApp::mousePressed(int x, int y, int button){
}

//--------------------------------------------------------------
void testApp::mouseReleased(){
}
