diff options
Diffstat (limited to 'vfg/src/testApp.cpp')
| -rwxr-xr-x | vfg/src/testApp.cpp | 83 |
1 files changed, 59 insertions, 24 deletions
diff --git a/vfg/src/testApp.cpp b/vfg/src/testApp.cpp index 4385593..d20bb23 100755 --- a/vfg/src/testApp.cpp +++ b/vfg/src/testApp.cpp @@ -3,12 +3,9 @@ //-------------------------------------------------------------- void testApp::setup(){ - //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=new song("JingleBells_v.4.0/VODA_MUS_JingleBells_Backing_v.4.0.mp3","JingleBells_v.4.0/VODA_MUS_JingleBells_Melody_v.4.0.mp3","VODA_MUS_JingleBells_MIDI_v.4.0.xml","Lyrics_JingleBells.4.0.xml","Levels_JingleBells.4.0.xml"); + songs.push_back(new song("JingleBells_v.4.0/VODA_MUS_JingleBells_Backing_v.4.0.mp3","JingleBells_v.4.0/VODA_MUS_JingleBells_Melody_v.4.0.mp3","VODA_MUS_JingleBells_MIDI_v.4.0.xml","Lyrics_JingleBells.4.0.xml","Levels_JingleBells.4.0.xml")); + songs.push_back(new song("DeckTheHalls_v.4.0/VODA_MUS_DeckTheHalls-Backing_v.4.0.mp3","DeckTheHalls_v.4.0/VODA_MUS_DeckTheHalls-Lead_v.4.0.mp3","VODA_MIDI_DeckTheHalls-v.4.0.xml","Lyrics_DeckTheHalls.4.0.xml","Levels_DeckTheHalls.4.0.xml")); - testsong->setTimeframe(3000); - testsong->setFlakeThresh(1000,100); - ofSetBackgroundAuto(false); ofBackground(0,0,0); @@ -23,7 +20,21 @@ void testApp::setup(){ raccoons[1].load("Raccoon-Purple.xml"); raccoons[2].load("Raccoon-Green.xml"); + tags.push_back(new Tag("Tags/TAG_Get-Ready.png",2000,0.5,0)); + tags.push_back(new Tag("Tags/TAG_Level-1.png",3000,0.5,0)); + tags.push_back(new Tag("Tags/TAG_Level-2.png",3000,0.5,0)); + tags.push_back(new Tag("Tags/TAG_Level-3.png",3000,0.5,0)); + tags.push_back(new Tag("Tags/TAG_Level-4.png",3000,0.5,0)); + + logos.push_back(new Billboard("Logo-VF.png",0.5,0.0)); + logos.push_back(new Billboard("Logo-DCC.png",0.36,0.855)); + + lyricspanel=new Billboard("Lyrics-panel.png",0.5,0.703); + banner.load("Ribbon/Dublin/Ribbon_%05i.png",500); + banner.setAnchorPercent(0.5,0.0); + banner.setFrameRate(50); + banner.play(); //loadanimals("Raccoons"); playanimal =&penguins; @@ -43,7 +54,8 @@ void testApp::setup(){ showFPS=false; - + currentsong=0; + nextsong=0; } /* void testApp::loadanimals(string which) { @@ -66,7 +78,7 @@ void testApp::loadanimals(string which) { */ void testApp::exit(){ - delete testsong; + delete lyricspanel; } //-------------------------------------------------------------- @@ -74,26 +86,32 @@ void testApp::update(){ int ret=game.update(); if (ret==1000) { currentlevel=0; - testsong->preRoll(250); + currentsong=nextsong; + songs[currentsong]->setTimeframe(3000); + songs[currentsong]->setFlakeThresh(1000,100); + songs[currentsong]->preRoll(750); + tags[0]->play(); } else if (ret>48&&ret<52) { - testsong->playerControl(ret-48); + songs[currentsong]->playerControl(ret-48); (*playanimal)[ret-49].playNow("Clap"); } - if (testsong->isPlaying&&testsong->getLevel(ofGetElapsedTimeMillis()+2000)>currentlevel) { + if (songs[currentsong]->isPlaying&&songs[currentsong]->getLevel(ofGetElapsedTimeMillis()+4000)>currentlevel) { int anim=ofRandom(1.9999); //this gives a binary random number for (int i=0;i<3;i++) { if (anim) (*playanimal)[i].playNow("Happy"); else (*playanimal)[i].playNow("Jump"); anim=(anim+1)%2; } - //printf("finished level %i!\n",currentlevel); + tags[currentlevel+1]->play(); currentlevel++; + printf("finished level %i!\n",currentlevel); } for (int i=0;i<3;i++) { (*playanimal)[i].update(); } background.update(); + banner.update(); } //-------------------------------------------------------------- @@ -111,23 +129,35 @@ void testApp::draw(){ ofRect(0,0,ofGetWidth(),ofGetHeight()); */ - if (testsong->isPlaying) { + if (songs[currentsong]->isPlaying) { ofSetColor(255,255,255); - testsong->drawNotes(); - int missed=testsong->missedNote(); + songs[currentsong]->drawNotes(); + int missed=songs[currentsong]->missedNote(); if (missed>-1) (*playanimal)[missed].playNow("Shudder"); - int hit=testsong->hitNote(); + int hit=songs[currentsong]->hitNote(); if (hit>-1) (*playanimal)[hit].play("Catch"); } ofSetColor(255,255,255); - for (int i=0;i<3;i++) (*playanimal)[i].draw(gridX[i]*ofGetWidth(),gridY[0]*ofGetHeight(),scale); - if (testsong->isPlaying) { + for (int i=0;i<3;i++) (*playanimal)[i].draw(gridX[i+1]*ofGetWidth(),gridY[0]*ofGetHeight(),scale); + if (songs[currentsong]->isPlaying) { ofSetColor(255,255,255); - testsong->draw(); + lyricspanel->draw(ofGetWidth()*0.5,ofGetHeight()*gridY[1],scale); + songs[currentsong]->draw(scale); } - else ofDrawBitmapString("game over!", (ofGetWidth()/2)-25,(ofGetHeight()/2)-5); - - if (showFPS) ofDrawBitmapString(ofToString(ofGetFrameRate()), ofGetWidth()-50,ofGetHeight()-15); + else { + ofDrawBitmapString("game over!", (ofGetWidth()/2)-25,(ofGetHeight()/2)-5); + logos[1]->draw(gridX[0]*ofGetWidth(),gridY[1]*ofGetHeight(),scale); + } + ofSetColor(255,255,255); + for (int i=0;i<tags.size();i++) { + if (tags[i]->isPlaying) tags[i]->draw(0.5f*ofGetWidth(),0,scale); + } + logos[0]->draw(gridX[0]*ofGetWidth(),0,scale); + float bannerscale=songs[currentsong]->isPlaying?scale*(1.0f-(max(0.0,min(((float)songs[currentsong]->getCurrentTime())*.001,1.0))*0.325)):scale; + banner.draw(ofGetWidth()*0.5,0,bannerscale); + char buf[30]; + sprintf(buf,"%.1f",ofGetFrameRate()); + if (showFPS) ofDrawBitmapString(buf, ofGetWidth()-50,(ofGetHeight()*gridY[1])-3); } @@ -135,15 +165,20 @@ void testApp::draw(){ void testApp::keyPressed(int key){ switch (key) { case ' ': - if (!testsong->isPlaying) { + nextsong=(nextsong+1)%songs.size(); + if (!songs[currentsong]->isPlaying) { currentlevel=0; - testsong->preRoll(250); + currentsong=nextsong; + songs[currentsong]->setTimeframe(3000); + songs[currentsong]->setFlakeThresh(1000,100); + songs[currentsong]->preRoll(750); + tags[0]->play(); } break; case '1': case '2': case '3': - testsong->playerControl(key-'1'); + songs[currentsong]->playerControl(key-'1'); (*playanimal)[key-'1'].playNow("Clap"); break; case 's': |
