X-Git-Url: https://git.dogcows.com/gitweb?a=blobdiff_plain;f=src%2FGameLayer.cc;h=54e40687cfdae138a94814abae26251ac5785e7a;hb=eceb970628068ae621ef9523a669a2b66a82fd8a;hp=d696f5ebdf851a0276f625f5c886eddb3dfd7594;hpb=449366f5f32d24f2a2a6589da6e16b2bf0d61773;p=chaz%2Fyoink diff --git a/src/GameLayer.cc b/src/GameLayer.cc index d696f5e..54e4068 100644 --- a/src/GameLayer.cc +++ b/src/GameLayer.cc @@ -9,7 +9,7 @@ * **************************************************************************/ -#include "../config.h" +#include "config.h" #include @@ -27,8 +27,8 @@ void GameLayer::loadSceneLoader() state_.script.import_standard_libraries(); moof::log::import(state_.script); - std::string path("loader"); - if (!moof::resource::find(path)) + std::string path = moof::resource::find_file("scenes/loader.lua"); + if (path.empty()) { throw std::runtime_error("cannot find scene loader script"); } @@ -80,15 +80,10 @@ void GameLayer::advanceScene(moof::settings& settings) GameLayer::GameLayer() { moof::log_info("about to load sound resource..."); - music_ = moof::resource::load("sounds/NightFusionIntro.ogg"); - if (music_) - { - music_->loop(true); - music_->enqueue("NightFusionLoop"); - } - else moof::log_error("music not loaded"); - - //music_->position(moof::vector3(10.0, 5.0, 0.0)); + music_.sample("sounds/NightFusionIntro.ogg"); + music_.loop(true); + music_.enqueue("sounds/NightFusionLoop.ogg"); + music_.position(moof::vector3(10.0, 5.0, 0.0)); mThinkTimer.init(boost::bind(&GameLayer::thinkTimer, this), 0.1, moof::timer::repeat); @@ -104,7 +99,7 @@ void GameLayer::did_add_to_view() { bool isMute = false; settings().get("nomusic", isMute); - if (!isMute) music_->play(); + music_.stream(); loadSceneLoader(); advanceScene(settings()); // load the first scene @@ -192,7 +187,7 @@ void GameLayer::draw(moof::scalar alpha) const state_.camera.upload_to_gl(alpha); // DRAW THE SCENE - moof::texture::reset_binding(); + moof::image::reset_binding(); glEnableClientState(GL_VERTEX_ARRAY); glEnableClientState(GL_TEXTURE_COORD_ARRAY); @@ -218,12 +213,12 @@ bool GameLayer::handle_event(const moof::event& event) { state_.heroine->animation.startSequence("Flattened"); moof::log_info("thump!"); - //mPunchSound.play(); + punch_sound_.play(); return true; } else if (event.key.keysym.sym == SDLK_m) { - music_->toggle(); + music_.toggle(); return true; } else if (event.key.keysym.sym == SDLK_PAGEUP)