summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim Redfern <tim@gray.(none)>2012-11-22 11:00:03 +0000
committerTim Redfern <tim@gray.(none)>2012-11-22 11:00:03 +0000
commit9dc429df9dbd1a5ae0f93d553ccfde7ab37a53a2 (patch)
treec0891b8554cf6973aae12ade27bd85be2a1f6a09
parentb4d89c0a9029739d2af1705b371dc28f27b6d2dc (diff)
gameplay good: up against memory limit
-rwxr-xr-xvfg/bin/data/Penguin-Blue.xml13
-rwxr-xr-xvfg/bin/data/Penguin-Green.xml13
-rwxr-xr-xvfg/bin/data/Penguin-Purple.xml13
-rwxr-xr-xvfg/bin/data/Raccoon-Blue.xml13
-rwxr-xr-xvfg/bin/data/Raccoon-Green.xml13
-rwxr-xr-xvfg/bin/data/Raccoon-Purple.xml13
-rwxr-xr-xvfg/bin/data/Settings.xml6
-rwxr-xr-xvfg/bin/data/Snowflake-Blue.xml5
-rwxr-xr-xvfg/bin/data/Snowflake-Green.xml5
-rwxr-xr-xvfg/bin/data/Snowflake-Purple.xml5
-rwxr-xr-xvfg/bin/data/flake.pngbin4570 -> 0 bytes
-rwxr-xr-xvfg/src/Puppet.cpp10
-rwxr-xr-xvfg/src/Puppet.h11
-rwxr-xr-xvfg/src/music.cpp23
-rwxr-xr-xvfg/src/music.h10
-rwxr-xr-xvfg/src/testApp.cpp77
-rwxr-xr-xvfg/src/testApp.h12
-rwxr-xr-xvfg/vfg.cbp6
-rw-r--r--vfg/vfg.layout31
19 files changed, 227 insertions, 52 deletions
diff --git a/vfg/bin/data/Penguin-Blue.xml b/vfg/bin/data/Penguin-Blue.xml
new file mode 100755
index 0000000..f14ca16
--- /dev/null
+++ b/vfg/bin/data/Penguin-Blue.xml
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<VFxmas>
+ <Clip name="base" files="Penguin/Penguin-Blue.png" frames="1"/>
+ <Clip name="Clap" files="Penguin/Penguin-Clap-Blue/Penguin-Clap-Blue_%05i.png" rate="50" frames="20"/>
+ <Clip name="Catch" files="Penguin/Penguin-Catch-Blue/Penguin-Catch-Blue_%05i.png" rate="50" frames="34"/>
+ <Clip name="Happy" files="Penguin/Penguin-Happy-Blue/Penguin-Happy-Blue_%05i.png" rate="50" frames="100"/>
+ <Clip name="Jump" files="Penguin/Penguin-Jump-Blue/Penguin-Jump-Blue_%05i.png" rate="50" frames="49"/>
+ <Clip name="Shudder" files="Penguin/Penguin-Shudder-Blue/Penguin-Shudder-Blue_%05i.png" rate="50" frames="30"/>
+ <Clip name="Shuffle" files="Penguin/Penguin-ShuffleShort-Blue/Penguin-ShuffleShort-Blue_%05i.png" rate="50" frames="101"/>
+ <Clip name="Walk_start" files="Penguin/Penguin-WalkingStart-Blue/Penguin-WalkingStart-Blue_%05i.png" rate="50" frames="11"/>
+ <Clip name="Walking" files="Penguin/Penguin-WalkingLoop-Blue/Penguin-WalkLoop-Blue_%05i.png" rate="50" frames="35"/>
+ <Clip name="Walk_end" files="Penguin/Penguin-WalkingEnd-Blue/Penguin-WalkingEnd-Blue_%05i.png" rate="50" start="118" frames="11"/>
+</VFxmas>
diff --git a/vfg/bin/data/Penguin-Green.xml b/vfg/bin/data/Penguin-Green.xml
new file mode 100755
index 0000000..7d8fe2c
--- /dev/null
+++ b/vfg/bin/data/Penguin-Green.xml
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<VFxmas>
+ <Clip name="base" files="Penguin/Penguin-Green.png" frames="1"/>
+ <Clip name="Clap" files="Penguin/Penguin-Clap-Green/Penguin-Clap-Green_%05i.png" rate="50" frames="20"/>
+ <Clip name="Catch" files="Penguin/Penguin-Catch-Green/Penguin-Catch-Green_%05i.png" rate="50" frames="34"/>
+ <Clip name="Happy" files="Penguin/Penguin-Happy-Green/Penguin-Happy-Green_%05i.png" rate="50" frames="100"/>
+ <Clip name="Jump" files="Penguin/Penguin-Jump-Green/Penguin-Jump-Green_%05i.png" rate="50" frames="49"/>
+ <Clip name="Shudder" files="Penguin/Penguin-Shudder-Green/Penguin-Shudder-Green_%05i.png" rate="50" frames="30"/>
+ <Clip name="Shuffle" files="Penguin/Penguin-ShuffleShort-Green/Penguin-ShuffleShort-Green_%05i.png" rate="50" frames="101"/>
+ <Clip name="Walk_start" files="Penguin/Penguin-WalkingStart-Green/Penguin-WalkingStart-Green_%05i.png" rate="50" frames="11"/>
+ <Clip name="Walking" files="Penguin/Penguin-WalkingLoop-Green/Penguin-WalkLoop-Green_%05i.png" rate="50" frames="35"/>
+ <Clip name="Walk_end" files="Penguin/Penguin-WalkingEnd-Green/Penguin-WalkingEnd-Green_%05i.png" rate="50" start="118" frames="11"/>
+</VFxmas>
diff --git a/vfg/bin/data/Penguin-Purple.xml b/vfg/bin/data/Penguin-Purple.xml
new file mode 100755
index 0000000..6f86554
--- /dev/null
+++ b/vfg/bin/data/Penguin-Purple.xml
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<VFxmas>
+ <Clip name="base" files="Penguin/Penguin-Purple.png" frames="1"/>
+ <Clip name="Clap" files="Penguin/Penguin-Clap-Purple/Penguin-Clap-Purple_%05i.png" rate="50" frames="20"/>
+ <Clip name="Catch" files="Penguin/Penguin-Catch-Purple/Penguin-Catch-Purple_%05i.png" rate="50" frames="34"/>
+ <Clip name="Happy" files="Penguin/Penguin-Happy-Purple/Penguin-Happy-Purple_%05i.png" rate="50" frames="100"/>
+ <Clip name="Jump" files="Penguin/Penguin-Jump-Purple/Penguin-Jump-Purple_%05i.png" rate="50" frames="49"/>
+ <Clip name="Shudder" files="Penguin/Penguin-Shudder-Purple/Penguin-Shudder-Purple_%05i.png" rate="50" frames="30"/>
+ <Clip name="Shuffle" files="Penguin/Penguin-ShuffleShort-Purple/Penguin-ShuffleShort-Purple_%05i.png" rate="50" frames="101"/>
+ <Clip name="Walk_start" files="Penguin/Penguin-WalkingStart-Purple/Penguin-WalkingStart-Purple_%05i.png" rate="50" frames="11"/>
+ <Clip name="Walking" files="Penguin/Penguin-WalkingLoop-Purple/Penguin-WalkLoop-Purple_%05i.png" rate="50" frames="35"/>
+ <Clip name="Walk_end" files="Penguin/Penguin-WalkingEnd-Purple/Penguin-WalkingEnd-Purple_%05i.png" rate="50" start="118" frames="11"/>
+</VFxmas>
diff --git a/vfg/bin/data/Raccoon-Blue.xml b/vfg/bin/data/Raccoon-Blue.xml
new file mode 100755
index 0000000..9e6283d
--- /dev/null
+++ b/vfg/bin/data/Raccoon-Blue.xml
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<VFxmas>
+ <Clip name="base" files="Raccoon/Raccoon-Blue.png" frames="1"/>
+ <Clip name="Clap" files="Raccoon/Raccoon-Clap-Blue/Raccoon-Clap-Blue_%05i.png" rate="50" frames="20"/>
+ <Clip name="Catch" files="Raccoon/Raccoon-Catch-Blue/Raccoon-Catch-Blue_%05i.png" rate="50" frames="34"/>
+ <Clip name="Happy" files="Raccoon/Raccoon-Happy-Blue/Raccoon-Catch-Blue_%05i.png" rate="50" frames="100"/>
+ <Clip name="Jump" files="Raccoon/Raccoon-Jump-Blue/Raccoon-Jump-Blue_%05i.png" rate="50" frames="49"/>
+ <Clip name="Shudder" files="Raccoon/Raccoon-Shudder-Blue/Raccoon-Shudder-Blue_%05i.png" rate="50" frames="30"/>
+ <Clip name="Shuffle" files="Raccoon/Raccoon-Shuffle-Blue/Raccoon-Shuffle-Blue_%05i.png" rate="50" frames="101"/>
+ <Clip name="Walk_start" files="Raccoon/Raccoon-StandDown-Blue/Raccoon-StandDown-Blue_%05i.png" rate="50" frames="20"/>
+ <Clip name="Walking" files="Raccoon/Raccoon-WalkLoop-Blue/Raccoon-WalkLoop-Blue_%05i.png" rate="50" start="20" frames="39"/>
+ <Clip name="Walk_end" files="Raccoon/Raccoon-StandUp-Blue/Raccoon-StandUp-Blue_%05i.png" rate="50" start="207" frames="43"/>
+</VFxmas>
diff --git a/vfg/bin/data/Raccoon-Green.xml b/vfg/bin/data/Raccoon-Green.xml
new file mode 100755
index 0000000..cbc8775
--- /dev/null
+++ b/vfg/bin/data/Raccoon-Green.xml
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<VFxmas>
+ <Clip name="base" files="Raccoon/Raccoon-Green.png" frames="1"/>
+ <Clip name="Clap" files="Raccoon/Raccoon-Clap-Green/Raccoon-Clap-Green_%05i.png" rate="50" frames="20"/>
+ <Clip name="Catch" files="Raccoon/Raccoon-Catch-Green/Raccoon-Catch-Green_%05i.png" rate="50" frames="34"/>
+ <Clip name="Happy" files="Raccoon/Raccoon-Happy-Green/Raccoon-Happy-Green_%05i.png" rate="50" frames="100"/>
+ <Clip name="Jump" files="Raccoon/Raccoon-Jump-Green/Raccoon-Jump-Green_%05i.png" rate="50" frames="49"/>
+ <Clip name="Shudder" files="Raccoon/Raccoon-Shudder-Green/Raccoon-Shudder-Green_%05i.png" rate="50" frames="30"/>
+ <Clip name="Shuffle" files="Raccoon/Raccoon-Shuffle-Green/Raccoon-Shuffle-Green_%05i.png" rate="50" frames="101"/>
+ <Clip name="Walk_start" files="Raccoon/Raccoon-StandDown-Green/Raccoon-StandDown-Green_%05i.png" rate="50" frames="20"/>
+ <Clip name="Walking" files="Raccoon/Raccoon-WalkLoop-Green/Raccoon-WalkLoop-Green_%05i.png" rate="50" start="20" frames="39"/>
+ <Clip name="Walk_end" files="Raccoon/Raccoon-StandUp-Green/Raccoon-StandUp-Green_%05i.png" rate="50" start="207" frames="43"/>
+</VFxmas>
diff --git a/vfg/bin/data/Raccoon-Purple.xml b/vfg/bin/data/Raccoon-Purple.xml
new file mode 100755
index 0000000..6dde4cc
--- /dev/null
+++ b/vfg/bin/data/Raccoon-Purple.xml
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<VFxmas>
+ <Clip name="base" files="Raccoon/Raccoon-Purple.png" frames="1"/>
+ <Clip name="Clap" files="Raccoon/Raccoon-Clap-Purple/Raccoon-Clap-Purple_%05i.png" rate="50" frames="20"/>
+ <Clip name="Catch" files="Raccoon/Raccoon-Catch-Purple/Raccoon-Catch-Purple_%05i.png" rate="50" frames="34"/>
+ <Clip name="Happy" files="Raccoon/Raccoon-Happy-Purple/Raccoon-Happy-Purple_%05i.png" rate="50" frames="100"/>
+ <Clip name="Jump" files="Raccoon/Raccoon-Jump-Purple/Raccoon-Jump-Purple_%05i.png" rate="50" frames="49"/>
+ <Clip name="Shudder" files="Raccoon/Raccoon-Shudder-Purple/Raccoon-Shudder-Purple_%05i.png" rate="50" frames="30"/>
+ <Clip name="Shuffle" files="Raccoon/Raccoon-Shuffle-Purple/Raccoon-Shuffle-Purple_%05i.png" rate="50" frames="101"/>
+ <Clip name="Walk_start" files="Raccoon/Raccoon-StandDown-Purple/Raccoon-StandDown-Purple_%05i.png" rate="50" frames="20"/>
+ <Clip name="Walking" files="Raccoon/Raccoon-WalkLoop-Purple/Raccoon-WalkLoop-Purple_%05i.png" rate="50" start="20" frames="39"/>
+ <Clip name="Walk_end" files="Raccoon/Raccoon-StandUp-Purple/Raccoon-StandUp-Purple_%05i.png" rate="50" start="207" frames="43"/>
+</VFxmas>
diff --git a/vfg/bin/data/Settings.xml b/vfg/bin/data/Settings.xml
new file mode 100755
index 0000000..58dfcaa
--- /dev/null
+++ b/vfg/bin/data/Settings.xml
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<VFxmas>
+ <Grid>
+
+ </Grid>
+</VFxmas>
diff --git a/vfg/bin/data/Snowflake-Blue.xml b/vfg/bin/data/Snowflake-Blue.xml
new file mode 100755
index 0000000..2b637fe
--- /dev/null
+++ b/vfg/bin/data/Snowflake-Blue.xml
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<VFxmas>
+ <Clip name="base" files="Snowflakes/Snowflake-Blue.png" frames="1" xAnchorPct="0.5" yAnchorPct="0.5"/>
+ <Clip name="shatter" files="Snowflakes/Snowflake-Shatter-Blue/Snowflake-Shatter-Blue_%05i.png" frames="32" rate="50" xAnchorPct="0.496" yAnchorPct="0.2"/>
+</VFxmas>
diff --git a/vfg/bin/data/Snowflake-Green.xml b/vfg/bin/data/Snowflake-Green.xml
new file mode 100755
index 0000000..dba0828
--- /dev/null
+++ b/vfg/bin/data/Snowflake-Green.xml
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<VFxmas>
+ <Clip name="base" files="Snowflakes/Snowflake-Green.png" frames="1" xAnchorPct="0.5" yAnchorPct="0.5"/>
+ <Clip name="shatter" files="Snowflakes/Snowflake-Shatter-Green/Snowflake-Shatter-Green_%05i.png" frames="32" rate="50" xAnchorPct="0.496" yAnchorPct="0.2"/>
+</VFxmas>
diff --git a/vfg/bin/data/Snowflake-Purple.xml b/vfg/bin/data/Snowflake-Purple.xml
new file mode 100755
index 0000000..244e553
--- /dev/null
+++ b/vfg/bin/data/Snowflake-Purple.xml
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<VFxmas>
+ <Clip name="base" files="Snowflakes/Snowflake-Purple.png" frames="1" xAnchorPct="0.5" yAnchorPct="0.5"/>
+ <Clip name="shatter" files="Snowflakes/Snowflake-Shatter-Purple/Snowflake-Shatter-Purple_%05i.png" frames="32" rate="50" xAnchorPct="0.496" yAnchorPct="0.2"/>
+</VFxmas>
diff --git a/vfg/bin/data/flake.png b/vfg/bin/data/flake.png
deleted file mode 100755
index b609837..0000000
--- a/vfg/bin/data/flake.png
+++ /dev/null
Binary files differ
diff --git a/vfg/src/Puppet.cpp b/vfg/src/Puppet.cpp
index 0fd07a6..90ba137 100755
--- a/vfg/src/Puppet.cpp
+++ b/vfg/src/Puppet.cpp
@@ -21,8 +21,8 @@ void Puppet::load(string filename) {
for (int i=0;i<XML.getNumTags("Clip");i++) {
string name=XML.getAttribute("Clip", "name","",i);
if (name!="") {
- clips[name]=ofxSprite();
- clips[name].load(XML.getAttribute("Clip", "files","",i),XML.getAttribute("Clip", "frames",0,i));
+ clips[name]=puppetSprite();
+ clips[name].load(XML.getAttribute("Clip", "files","",i),XML.getAttribute("Clip", "frames",0,i),XML.getAttribute("Clip", "start",0,i));
clips[name].setAnchorPercent(XML.getAttribute("Clip", "xAnchorPct",0.5,i),XML.getAttribute("Clip", "yAnchorPct",0.5,i));
clips[name].setFrameRate(XML.getAttribute("Clip", "rate",25,i));
clips[name].setLoop(false);
@@ -34,7 +34,7 @@ void Puppet::load(string filename) {
}
}
-void Puppet::draw(float x, float y) {
+void Puppet::draw(float x, float y, float scale) {
if (playlist.size()>0) {
if (!clips[playlist[0]].getIsPlaying()) {
playlist.erase(playlist.begin());
@@ -44,11 +44,11 @@ void Puppet::draw(float x, float y) {
}
}
if (playlist.size()==0) {
- if (clips.find("base") != clips.end()) clips["base"].draw(x,y);
+ if (clips.find("base") != clips.end()) clips["base"].draw(x,y,scale);
}
else {
clips[playlist[0]].update();
- clips[playlist[0]].draw(x,y);
+ clips[playlist[0]].draw(x,y,scale);
}
}
diff --git a/vfg/src/Puppet.h b/vfg/src/Puppet.h
index e0df87a..7ee80ee 100755
--- a/vfg/src/Puppet.h
+++ b/vfg/src/Puppet.h
@@ -11,6 +11,13 @@
TODO: make resolution independent
*/
+class puppetSprite: public ofxSprite {
+ public:
+ void draw(float x, float y, float scale) {
+ getCurrentImage().draw(x-(anchorPoint.x*scale),y-(anchorPoint.y*scale),getWidth()*scale,getHeight()*scale);
+ }
+};
+
class Puppet
{
public:
@@ -19,11 +26,11 @@ class Puppet
void load(string filename);
void play(string clip);
void playNow(string clip);
- void draw(float x, float y);
+ void draw(float x, float y, float scale=1.0f);
bool isPlaying();
protected:
private:
- map<string,ofxSprite> clips;
+ map<string,puppetSprite> clips;
deque<string> playlist;
};
diff --git a/vfg/src/music.cpp b/vfg/src/music.cpp
index eda58be..359b21d 100755
--- a/vfg/src/music.cpp
+++ b/vfg/src/music.cpp
@@ -32,6 +32,7 @@ musicscore::musicscore() {
missedLast=false;
nowpoint=1.0f;
missedNote=-1;
+ hitNote=-1;
snowflakes.push_back(Puppet());
snowflakes.push_back(Puppet());
@@ -163,7 +164,7 @@ void musicscore::drawNotes(levelscore *levels) {
int thisnote=iter->second->num-firstnote;
int thisstart=iter->first-scoreStart;
int thislength=iter->second->duration;
- ofSetColor(ofColor::fromHsb(((float)thisnote*255)/numnotes,200,100));
+ ofSetColor(ofColor::fromHsb(((float)thisnote*255)/numnotes,200,100),120);
ofRect(thisnote*widthStep,ofGetHeight()-(thisstart*heightStep),widthStep,-(thislength*heightStep));
}
@@ -172,6 +173,7 @@ void musicscore::drawFlakes(levelscore *levels) {
ofEnableAlphaBlending();
int scoreStart=ofGetElapsedTimeMillis()-startTime-((1.0f-nowpoint)*timeframe);
int scoreEnd=scoreStart+timeframe;
+ float scale=ofGetHeight()/1080.0f;
//note drawing 46h - 52h
int numnotes=16;
int firstnote=70;
@@ -190,7 +192,7 @@ void musicscore::drawFlakes(levelscore *levels) {
//if (iter->second->activated&&(!iter->second->disintegrated)) iter->second->disintegrate();
ofSetColor(255,255,255);
- iter->second->draw((notemap(iter->second->num)*300)+100,ofGetHeight()-(thisstart*heightStep));
+ iter->second->draw(gridX[notemap(iter->second->num)]*ofGetWidth(),ofGetHeight()-(thisstart*heightStep),scale);
//todo - make all drawing resolution independent
}
@@ -201,16 +203,17 @@ void musicscore::drawFlakes(levelscore *levels) {
missedLast=false;
map<int,flake*>::iterator missed=flakes.end();
int scoreTime=ofGetElapsedTimeMillis()-startTime;
- for (iter = flakes.lower_bound(levels->getLowerBound(levels->getLevel(scoreStart))); iter != flakes.upper_bound(scoreStart); iter++){
+ for (iter = flakes.lower_bound(levels->getLowerBound(levels->getLevel(scoreStart))); iter != flakes.lower_bound(scoreStart); iter++){
if (!iter->second->activated) {
missedFlakes++;
missed=iter;
}
missedLast=!iter->second->activated;
- }
+ }
+ //at this point missed points to the latest unactivated flake in the level
if ((missed!=flakes.end())&&(missedFlake!=missed)) {
missedFlake=missed;
- missedNote=notemap(iter->second->num);
+ missedNote=notemap(missed->second->num);
}
else missedNote=-1;
@@ -220,7 +223,10 @@ void musicscore::playerControl(int key,int threshold){
map<int,flake*>::iterator iter;
int scoreTime=ofGetElapsedTimeMillis()-startTime;
for (iter = flakes.lower_bound(scoreTime-threshold); iter != flakes.upper_bound(scoreTime+threshold); iter++) {
- if (key==notemap(iter->second->num)) iter->second->activate();
+ if (key==notemap(iter->second->num)) {
+ iter->second->activate();
+ hitNote=key;
+ }
}
}
//---------------------------------------------------------------------------------------------------------------------------------------------
@@ -296,4 +302,9 @@ void song::playerControl(int key){
}
int song::missedNote(){
return notes.missedNote;
+}
+int song::hitNote(){
+ int n=notes.hitNote;
+ notes.hitNote=-1;
+ return n;
}
diff --git a/vfg/src/music.h b/vfg/src/music.h
index f9317de..7e54292 100755
--- a/vfg/src/music.h
+++ b/vfg/src/music.h
@@ -4,6 +4,10 @@
#include "ofxXmlSettings.h"
#include "Puppet.h"
+//Grid for drawing
+static float gridX[3]={0.3,0.5,0.7};
+static float gridY[1]={0.8};
+
//event times are absolute integer milliseconds
//---------------------------------------------------------------------------------------------------------------------------------------------
class levelscore {
@@ -73,8 +77,8 @@ class flake: public note, public Puppet {
activated=true;
puppet.play("shatter");
}
- void draw(float x, float y) {
- if (!activated||puppet.isPlaying()) puppet.draw(x,y);
+ void draw(float x, float y,float scale) {
+ if (!activated||puppet.isPlaying()) puppet.draw(x,y,scale);
}
};
//---------------------------------------------------------------------------------------------------------------------------------------------
@@ -144,6 +148,7 @@ class musicscore: public score {
int missedFlakes;
int missedNote;
+ int hitNote;
bool missedLast;
bool perfect;
@@ -170,6 +175,7 @@ class song {
void drawNotes();
void draw();
int missedNote();
+ int hitNote();
bool isPlaying;
void playerControl(int key);
private:
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;
}
}
diff --git a/vfg/src/testApp.h b/vfg/src/testApp.h
index f62c098..4ab807f 100755
--- a/vfg/src/testApp.h
+++ b/vfg/src/testApp.h
@@ -72,10 +72,22 @@ class testApp : public ofBaseApp{
void windowResized(int w, int h);
void dragEvent(ofDragInfo dragInfo);
void gotMessage(ofMessage msg);
+
+ void loadanimals(string which);
+
+ ofVideoPlayer background;
+ ofImage vignette;
song *testsong;
+ /*
vector<Animal> penguins;
+ vector<Animal> raccoons;
+ */
+
+ vector<Animal> playanimals;
+
+ vector<Animal>* playanimal;
Puppet testpenguin;
diff --git a/vfg/vfg.cbp b/vfg/vfg.cbp
index 7480047..21ad2a0 100755
--- a/vfg/vfg.cbp
+++ b/vfg/vfg.cbp
@@ -33,6 +33,12 @@
<Unit filename="config.make">
<Option virtualFolder="build config" />
</Unit>
+ <Unit filename="src/Animal.cpp">
+ <Option virtualFolder="src/" />
+ </Unit>
+ <Unit filename="src/Animal.h">
+ <Option virtualFolder="src/" />
+ </Unit>
<Unit filename="src/Asterisk.cpp">
<Option virtualFolder="src/" />
</Unit>
diff --git a/vfg/vfg.layout b/vfg/vfg.layout
index 4c64d90..48e2935 100644
--- a/vfg/vfg.layout
+++ b/vfg/vfg.layout
@@ -1,31 +1,34 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<CodeBlocks_layout_file>
<ActiveTarget name="Debug" />
- <File name="addons.make" open="1" top="0" tabpos="2">
+ <File name="addons.make" open="0" top="0" tabpos="2">
<Cursor position="62" topLine="0" />
</File>
- <File name="src/Asterisk.cpp" open="1" top="0" tabpos="3">
+ <File name="src/Asterisk.cpp" open="1" top="0" tabpos="1">
<Cursor position="48" topLine="3" />
</File>
- <File name="src/Asterisk.h" open="1" top="0" tabpos="5">
- <Cursor position="1219" topLine="22" />
+ <File name="src/Asterisk.h" open="1" top="0" tabpos="3">
+ <Cursor position="1108" topLine="22" />
</File>
- <File name="src/Puppet.cpp" open="1" top="0" tabpos="8">
- <Cursor position="138" topLine="0" />
+ <File name="src/Puppet.cpp" open="1" top="0" tabpos="5">
+ <Cursor position="1221" topLine="23" />
</File>
- <File name="src/main.cpp" open="1" top="0" tabpos="1">
+ <File name="src/Puppet.h" open="1" top="0" tabpos="4">
+ <Cursor position="312" topLine="0" />
+ </File>
+ <File name="src/main.cpp" open="0" top="0" tabpos="1">
<Cursor position="219" topLine="0" />
</File>
- <File name="src/music.cpp" open="1" top="0" tabpos="6">
- <Cursor position="6704" topLine="143" />
+ <File name="src/music.cpp" open="0" top="0" tabpos="6">
+ <Cursor position="8331" topLine="170" />
</File>
<File name="src/music.h" open="0" top="0" tabpos="6">
- <Cursor position="4066" topLine="114" />
+ <Cursor position="4738" topLine="125" />
</File>
- <File name="src/testApp.cpp" open="1" top="1" tabpos="4">
- <Cursor position="2271" topLine="6" />
+ <File name="src/testApp.cpp" open="1" top="1" tabpos="6">
+ <Cursor position="2883" topLine="72" />
</File>
- <File name="src/testApp.h" open="1" top="0" tabpos="7">
- <Cursor position="1440" topLine="36" />
+ <File name="src/testApp.h" open="1" top="0" tabpos="2">
+ <Cursor position="2068" topLine="57" />
</File>
</CodeBlocks_layout_file>