summaryrefslogtreecommitdiff
path: root/src/boundary.cpp
diff options
context:
space:
mode:
authorComment <tim@gray.(none)>2013-01-29 01:52:00 +0000
committerComment <tim@gray.(none)>2013-01-29 01:52:00 +0000
commitba37049c44ff64b3c6482a5e2f199f178351a69f (patch)
tree2a585dc6a4a169e894b841b343d5763b94e3c1f5 /src/boundary.cpp
parentf7667bd306b983f8f8daa0b40719aa665bf555b0 (diff)
mostly working
Diffstat (limited to 'src/boundary.cpp')
-rwxr-xr-xsrc/boundary.cpp32
1 files changed, 27 insertions, 5 deletions
diff --git a/src/boundary.cpp b/src/boundary.cpp
index 64957ed..2425c4a 100755
--- a/src/boundary.cpp
+++ b/src/boundary.cpp
@@ -5,9 +5,10 @@ boundary::boundary()
filename="";
}
-boundary::boundary(string file)
+boundary::boundary(string file,float vol)
{
- filename=file;
+ openFile(file);
+ sound.setVolume(vol);
}
boundary::~boundary()
@@ -77,7 +78,28 @@ bool boundary::contains(ofPoint p)
else
return true;
}
-
-void boundary::checkfile(ofPoint pos,string file) {
- if (contains(pos)) filename=file;
+void boundary::openFile(string file) {
+ filename=file;
+ if (filename.length()>0) {
+ if (sound.loadSound(filename)) sound.setLoop(false);
+ else printf("failed to load %s\n",filename.c_str());
+ }
+}
+bool boundary::checkFile(ofPoint pos,string file) {
+ if (contains(pos)) {
+ sound.stop();
+ openFile(file);
+ return true;
+ }
+ else return false;
+}
+bool boundary::checkClick(ofPoint pos){
+ if (contains(pos)&&sound.isLoaded()&&!sound.getIsPlaying()) {
+ sound.play();
+ return true;
+ }
+ else return false;
}
+void boundary::setVolume(float vol){
+ sound.setVolume(vol);
+}