diff options
| author | Tim Redfern <tim@gray.(none)> | 2012-11-22 11:00:03 +0000 |
|---|---|---|
| committer | Tim Redfern <tim@gray.(none)> | 2012-11-22 11:00:03 +0000 |
| commit | 9dc429df9dbd1a5ae0f93d553ccfde7ab37a53a2 (patch) | |
| tree | c0891b8554cf6973aae12ade27bd85be2a1f6a09 /vfg/src/testApp.cpp | |
| parent | b4d89c0a9029739d2af1705b371dc28f27b6d2dc (diff) | |
gameplay good: up against memory limit
Diffstat (limited to 'vfg/src/testApp.cpp')
| -rwxr-xr-x | vfg/src/testApp.cpp | 77 |
1 files changed, 54 insertions, 23 deletions
diff --git a/vfg/src/testApp.cpp b/vfg/src/testApp.cpp index 8dd6110..bcef98e 100755 --- a/vfg/src/testApp.cpp +++ b/vfg/src/testApp.cpp @@ -3,8 +3,6 @@ //-------------------------------------------------------------- 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); @@ -12,28 +10,21 @@ void testApp::setup(){ ofSetBackgroundAuto(false); ofBackground(0,0,0); - //printf("%s\n",ofVAArgsToString("Penguin-Clap-Blue_00000.png", 1).c_str()); ??? + /* for (int i=0;i<3;i++) penguins.push_back(Animal()); penguins[0].load("Penguin-Blue.xml"); penguins[1].load("Penguin-Purple.xml"); penguins[2].load("Penguin-Green.xml"); - /* - penguins[0].load("Penguin-Clap-Blue/Penguin-Clap-Blue_%05i.png",20); - penguins[0].setAnchorPercent(0.5, 1.0); - penguins[0].setFrameRate(50); - penguins[0].setLoop(false); - penguins[1].load("Penguin-Clap-Purple/Penguin-Clap-Purple_%05i.png",20); - penguins[1].setAnchorPercent(0.5, 1.0); - penguins[1].setFrameRate(50); - penguins[1].setLoop(false); - penguins[2].load("Penguin-Clap-Green/Penguin-Clap-Green_%05i.png",20); - penguins[2].setAnchorPercent(0.5, 1.0); - penguins[2].setFrameRate(50); - penguins[2].setLoop(false); + for (int i=0;i<3;i++) raccoons.push_back(Animal()); + raccoons[0].load("Raccoon-Blue.xml"); + raccoons[1].load("Raccoon-Purple.xml"); + raccoons[2].load("Raccoon-Green.xml"); */ - - //printf(ofSystem("ls -la").c_str()); + + + loadanimals("Penguins"); + playanimal =&playanimals; //testpenguin.load("Penguin-Blue.xml"); //debug: commented out: 436m 257m @@ -42,11 +33,34 @@ void testApp::setup(){ //release: commented out: 436m 256m //508fr 1.4s load in use: 836m 443m + background.loadMovie("Background_v3.mp4"); + background.setLoopState(OF_LOOP_NORMAL); + background.play(); + + vignette.loadImage("Vignette.png"); showFPS=false; } +void testApp::loadanimals(string which) { + playanimals.clear(); + + for (int i=0;i<3;i++) playanimals.push_back(Animal()); + + if (which=="Penguins") { + playanimals[0].load("Penguin-Blue.xml"); + playanimals[1].load("Penguin-Purple.xml"); + playanimals[2].load("Penguin-Green.xml"); + } + else { + playanimals[0].load("Raccoon-Blue.xml"); + playanimals[1].load("Raccoon-Purple.xml"); + playanimals[2].load("Raccoon-Green.xml"); + } + +} + void testApp::exit(){ delete testsong; } @@ -59,28 +73,39 @@ void testApp::update(){ } else if (ret>0) { testsong->playerControl(ret); - penguins[ret-1].playNow("Clap"); + (*playanimal)[ret-1].playNow("Clap"); } for (int i=0;i<3;i++) { - penguins[i].update(); + (*playanimal)[i].update(); } + background.update(); } //-------------------------------------------------------------- void testApp::draw(){ + ofDisableAlphaBlending(); + ofSetColor(255,255,255); + background.draw(0,0,ofGetWidth(),ofGetHeight()); + float scale=ofGetHeight()/1080.0f; + ofEnableAlphaBlending(); + vignette.draw(0,0,ofGetWidth(),ofGetHeight()); //ofBackground(0,0,0,0.1); + /* ofSetColor(0,0,0,100); ofRect(0,0,ofGetWidth(),ofGetHeight()); + */ if (testsong->isPlaying) { ofSetColor(255,255,255); testsong->drawNotes(); int missed=testsong->missedNote(); - if (missed>-1) penguins[missed].playNow("Shudder"); + if (missed>-1) (*playanimal)[missed].playNow("Shudder"); + int hit=testsong->hitNote(); + if (hit>-1) (*playanimal)[hit].play("Catch"); } ofSetColor(255,255,255); - for (int i=0;i<3;i++) penguins[i].draw((i*300)+100,600); + for (int i=0;i<3;i++) (*playanimal)[i].draw(gridX[i]*ofGetWidth(),gridY[0]*ofGetHeight(),scale); if (testsong->isPlaying) { ofSetColor(255,255,255); testsong->draw(); @@ -103,7 +128,7 @@ void testApp::keyPressed(int key){ case '2': case '3': testsong->playerControl(key-'1'); - penguins[key-'1'].playNow("Clap"); + (*playanimal)[key-'1'].playNow("Clap"); break; case 's': game.startGame(); @@ -111,6 +136,12 @@ void testApp::keyPressed(int key){ case 'f': showFPS=!showFPS; break; + case 'r': + loadanimals("Raccoons"); + break; + case 'p': + loadanimals("Penguins"); + break; } } |
