summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim Redfern <tim@gray.(none)>2012-11-05 19:03:32 +0000
committerTim Redfern <tim@gray.(none)>2012-11-05 19:03:32 +0000
commitb5aba6fcbf2847735b0c43e84d0933797c73f581 (patch)
treeb6a38a9f11f3501d5f9cd0459af4654881987899
parentf4719e4e997a05bb423e9ca691de50bcbf1cb375 (diff)
gameplay demo #1
-rwxr-xr-xvfg/src/main.cpp2
-rwxr-xr-xvfg/src/music.cpp40
-rwxr-xr-xvfg/src/testApp.cpp2
-rwxr-xr-xvfg/src/testApp.h6
-rwxr-xr-xvfg/vfg.cbp3
-rw-r--r--vfg/vfg.layout18
6 files changed, 43 insertions, 28 deletions
diff --git a/vfg/src/main.cpp b/vfg/src/main.cpp
index 6a32c6a..ead5d41 100755
--- a/vfg/src/main.cpp
+++ b/vfg/src/main.cpp
@@ -6,7 +6,7 @@
int main( ){
ofAppGlutWindow window;
- ofSetupOpenGL(&window, 1024,768, OF_WINDOW); // <-------- setup the GL context
+ ofSetupOpenGL(&window, 800,800, OF_WINDOW); // <-------- setup the GL context
// this kicks off the running of my app
// can be OF_WINDOW or OF_FULLSCREEN
diff --git a/vfg/src/music.cpp b/vfg/src/music.cpp
index 286bdcb..096e630 100755
--- a/vfg/src/music.cpp
+++ b/vfg/src/music.cpp
@@ -11,7 +11,7 @@ note::note(int n,int v,int d){
//---------------------------------------------------------------------------------------------------------------------------------------------
//---------------------------------------------------------------------------------------------------------------------------------------------
musicscore::musicscore() {
- timeframe=10000;
+ timeframe=2000;
flake.loadImage("flake.png");
flake.setAnchorPercent(0.5,0.5);
}
@@ -105,21 +105,21 @@ void musicscore::parseMidi(string filename){
int lastTime=0;
stars[notes.begin()->first]=notes.begin()->second;
for (iter1 = notes.begin(); iter1 != notes.end(); iter1++) {
- if ((iter1->second->num/5!=lastNote->num/5)||(lastTime-iter1->first>noteThresh)) {
+ if ((iter1->second->num/5!=lastNote->num/5)||(iter1->first-lastTime>noteThresh)) {
stars[iter1->first]=iter1->second;
}
lastNote=iter1->second;
lastTime=iter1->first;
}
-
- interactionThresh=100; //how long player has to respond
+
+ interactionThresh=200; //how long player has to respond
missedTime=-1;
-
-
+
+
}
void musicscore::setTimeframe(int millis) {timeframe=millis;}
void musicscore::draw() {
- ofEnableAlphaBlending();
+ ofEnableAlphaBlending();
int scoreStart=ofGetElapsedTimeMillis()-startTime;
int scoreEnd=scoreStart+timeframe;
//temporary drawing method 46h - 52h
@@ -128,28 +128,28 @@ void musicscore::draw() {
float widthStep=((float)ofGetWidth())/numnotes;
float heightStep=((float)ofGetHeight())/timeframe;
map<int,note*>::iterator iter;
-
- for (iter = notes.lower_bound(scoreStart); iter != notes.upper_bound(scoreEnd); ++iter) {
+
+ for (iter = notes.lower_bound(scoreStart); iter != notes.upper_bound(scoreEnd); ++iter) {
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));
ofRect(thisnote*widthStep,ofGetHeight()-(thisstart*heightStep),widthStep,-(thislength*heightStep));
-
+
//different methods for generating flakes
//ideally theres a variable clumping factor, this means pre-processing the flakes though
-
+
//ofSetColor(ofColor::fromHsb(((float)thisnote*255)/numnotes,200,255));
-
+
//flake.draw((thisnote+0.5f)*widthStep,ofGetHeight()-(thisstart*heightStep));
//flake.draw((iter->second->updown*ofGetWidth()*0.33)+(ofGetWidth()*0.5),ofGetHeight()-(thisstart*heightStep));
//flake.draw((((thisnote/5)*5)+3.5f)*widthStep,ofGetHeight()-(thisstart*heightStep));
}
- for (iter = stars.lower_bound(scoreStart); iter != stars.upper_bound(scoreEnd); ++iter) {
+ for (iter = stars.lower_bound(scoreStart-200); iter != stars.upper_bound(scoreEnd); ++iter) { //added extra 200ms for flake to leave screen
int thisnote=iter->second->num-firstnote;
int thisstart=iter->first-scoreStart;
int thislength=iter->second->duration;
-
+
// check player interaction
if (thisstart<interactionThresh) {
//this star needs to be interacted with
@@ -160,7 +160,7 @@ void musicscore::draw() {
}
if (iter->second->activated) ofSetColor(255,255,255);
else ofSetColor(ofColor::fromHsb(((float)thisnote*255)/numnotes,200,255));
- flake.draw((((thisnote/5)*5)+3.5f)*widthStep,ofGetHeight()-(thisstart*heightStep));
+ flake.draw((((thisnote/5)*5)+3.5f)*widthStep,ofGetHeight()-(thisstart*heightStep),flake.getWidth()/2,flake.getHeight()/2);
}
//check for unactivated stars. must be a better way
missedTime=-1;
@@ -188,18 +188,18 @@ void song::play() {
melody.play();
startTime=ofGetElapsedTimeMillis();
notes.startTime=startTime;
- isPlaying=true;
+ isPlaying=true;
}
-void song::stop() {
+void song::stop() {
backing.stop();
melody.stop();
- isPlaying=false;
+ isPlaying=false;
}
void song::preRoll(long preroll) {
startTime=ofGetElapsedTimeMillis()+preroll;
notes.startTime=startTime;
isPreroll=true;
- isPlaying=true;
+ isPlaying=true;
}
void song::draw(){
//how to deal with end/ track length/ part of game?
@@ -212,7 +212,7 @@ void song::draw(){
}
if (notes.missedTime>0) {
if (notes.missedTime>missedInterval) stop();
- else melody.setVolume(1.0f-((float)notes.missedTime/(float)missedInterval));
+ else melody.setVolume(0.0f); //1.0f-((float)notes.missedTime/(float)missedInterval));
}
else melody.setVolume(1.0f);
notes.draw();
diff --git a/vfg/src/testApp.cpp b/vfg/src/testApp.cpp
index 2a67d8f..c0c3671 100755
--- a/vfg/src/testApp.cpp
+++ b/vfg/src/testApp.cpp
@@ -3,7 +3,7 @@
//--------------------------------------------------------------
void testApp::setup(){
testsong=new song("VODA_MUS_DeckTheHalls-Backing_v.1.3.mp3","VODA_MUS_DeckTheHalls-Melody_v.1.3.mp3","MIDI_DeckTheHalls_Test.1.3.xml");
- testsong->setTimeframe(1500);
+ testsong->setTimeframe(10000);
testsong->preRoll(250);
ofSetBackgroundAuto(false);
diff --git a/vfg/src/testApp.h b/vfg/src/testApp.h
index cb29222..5a8805a 100755
--- a/vfg/src/testApp.h
+++ b/vfg/src/testApp.h
@@ -32,6 +32,12 @@ while playing - game full volume - if you miss a flake - starts countdown - game
keys - volume - control drawing of stars - game state
+
+changes 05112012
+
+event suppression working?
+overlap
+
*/
class game {
diff --git a/vfg/vfg.cbp b/vfg/vfg.cbp
index 18e5af4..ca92267 100755
--- a/vfg/vfg.cbp
+++ b/vfg/vfg.cbp
@@ -27,6 +27,9 @@
<Option projectLinkerOptionsRelation="2" />
</Target>
</Build>
+ <Unit filename="bin/data/MIDI_DeckTheHalls_Test.1.3.xml">
+ <Option virtualFolder="addons/" />
+ </Unit>
<Unit filename="config.make">
<Option virtualFolder="build config" />
</Unit>
diff --git a/vfg/vfg.layout b/vfg/vfg.layout
index 486875b..87ed139 100644
--- a/vfg/vfg.layout
+++ b/vfg/vfg.layout
@@ -1,16 +1,22 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<CodeBlocks_layout_file>
<ActiveTarget name="Debug" />
- <File name="src/music.cpp" open="1" top="0" tabpos="4">
- <Cursor position="7713" topLine="172" />
+ <File name="bin/data/MIDI_DeckTheHalls_Test.1.3.xml" open="0" top="0" tabpos="5">
+ <Cursor position="1919" topLine="0" />
</File>
- <File name="src/music.h" open="1" top="1" tabpos="3">
- <Cursor position="1389" topLine="5" />
+ <File name="src/main.cpp" open="1" top="0" tabpos="1">
+ <Cursor position="219" topLine="0" />
</File>
- <File name="src/testApp.cpp" open="1" top="0" tabpos="2">
+ <File name="src/music.cpp" open="1" top="1" tabpos="2">
+ <Cursor position="7244" topLine="139" />
+ </File>
+ <File name="src/music.h" open="0" top="0" tabpos="3">
+ <Cursor position="1000" topLine="12" />
+ </File>
+ <File name="src/testApp.cpp" open="0" top="0" tabpos="2">
<Cursor position="1017" topLine="5" />
</File>
- <File name="src/testApp.h" open="1" top="0" tabpos="1">
+ <File name="src/testApp.h" open="0" top="0" tabpos="1">
<Cursor position="576" topLine="0" />
</File>
</CodeBlocks_layout_file>