diff options
Diffstat (limited to 'vfg/src/testApp.cpp')
| -rwxr-xr-x | vfg/src/testApp.cpp | 44 |
1 files changed, 28 insertions, 16 deletions
diff --git a/vfg/src/testApp.cpp b/vfg/src/testApp.cpp index 52f2a3a..928604d 100755 --- a/vfg/src/testApp.cpp +++ b/vfg/src/testApp.cpp @@ -6,9 +6,7 @@ void testApp::setup(){ //for (float i=0;i<1.2;i+=0.1) printf("%f in level %i bound %f\n",i,lives->getLevel(i),lives->getLowerBound(lives->getLevel(i))); testsong=new song("VODA_MUS_DeckTheHalls-Backing_v.1.5.mp3","VODA_MUS_DeckTheHalls-Melody_v.1.5.mp3","MIDI_DeckTheHalls_MIDI.1.5.xml","Lyrics_DeckTheHalls.1.5.xml","Levels_DeckTheHalls.1.5.xml"); - testsong->setTimeframe(2500); - testsong->setFlakeThresh(1000,100); - testsong->preRoll(250); + ofSetBackgroundAuto(false); ofBackground(0,0,0); @@ -28,7 +26,7 @@ void testApp::setup(){ penguins[2].setFrameRate(50); penguins[2].setLoop(false); - printf("blue clap: %i\n",penguins[0].getTotalFrames()); + //printf(ofSystem("ls -la").c_str()); } void testApp::exit(){ @@ -37,12 +35,19 @@ void testApp::exit(){ //-------------------------------------------------------------- void testApp::update(){ - - for (int i=0;i<3;i++) { - penguins[i].update(); - } - - + int ret=game.update(); + if (ret==1000) { + testsong->setTimeframe(2500); + testsong->setFlakeThresh(1000,100); + testsong->preRoll(250); + } + else if (ret>0) { + testsong->playerControl(ret); + penguins[ret-1].play(); + } + for (int i=0;i<3;i++) { + penguins[i].update(); + } } //-------------------------------------------------------------- @@ -51,14 +56,18 @@ void testApp::draw(){ //ofBackground(0,0,0,0.1); ofSetColor(0,0,0,100); ofRect(0,0,ofGetWidth(),ofGetHeight()); - ofSetColor(255,255,255); - testsong->drawNotes(); + + if (testsong->isPlaying) { + ofSetColor(255,255,255); + testsong->drawNotes(); + } ofSetColor(255,255,255); for (int i=0;i<3;i++) penguins[i].draw((i*300)+100,800); - testsong->draw(); - if (!testsong->isPlaying) ofDrawBitmapString("game over!", (ofGetWidth()/2)-25,(ofGetHeight()/2)-5); - - + if (testsong->isPlaying) { + ofSetColor(255,255,255); + testsong->draw(); + } + else ofDrawBitmapString("game over!", (ofGetWidth()/2)-25,(ofGetHeight()/2)-5); } @@ -74,6 +83,9 @@ void testApp::keyPressed(int key){ testsong->playerControl(key-'0'); penguins[key-'1'].play(); break; + case 's': + game.startGame(); + break; } } |
