]> Dogcows Code - chaz/yoink/blobdiff - src/GameLayer.cc
pkg-config libs parsing bugfix
[chaz/yoink] / src / GameLayer.cc
index 0498182a9888b22eaac118a55f26b16df2025f86..d696f5ebdf851a0276f625f5c886eddb3dfd7594 100644 (file)
@@ -9,6 +9,8 @@
 *
 **************************************************************************/
 
+#include "../config.h"
+
 #include <stdexcept>
 
 #include <moof/log.hh>
 
 #include "GameLayer.hh"
 
-#if HAVE_CONFIG_H
-#include "config.h"
-#endif
-
 
 void GameLayer::loadSceneLoader()
 {
@@ -30,7 +28,7 @@ void GameLayer::loadSceneLoader()
        moof::log::import(state_.script);
 
        std::string path("loader");
-       if (!Scene::find_path(path))
+       if (!moof::resource::find(path))
        {
                throw std::runtime_error("cannot find scene loader script");
        }
@@ -79,14 +77,18 @@ void GameLayer::advanceScene(moof::settings& settings)
 }
 
 
-GameLayer::GameLayer() :
-       mMusic("NightFusionIntro"),
-       mPunchSound("Thump")
+GameLayer::GameLayer()
 {
-       mMusic.loop(true);
-       mMusic.enqueue("NightFusionLoop");
+       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");
 
-       //mMusic.setPosition(moof::vector3(10.0, 5.0, 0.0));
+       //music_->position(moof::vector3(10.0, 5.0, 0.0));
 
        mThinkTimer.init(boost::bind(&GameLayer::thinkTimer, this),
                        0.1, moof::timer::repeat);
@@ -102,7 +104,7 @@ void GameLayer::did_add_to_view()
 {
        bool isMute = false;
        settings().get("nomusic", isMute);
-       if (!isMute) mMusic.play();
+       if (!isMute) music_->play();
 
        loadSceneLoader();
        advanceScene(settings());               // load the first scene
@@ -216,12 +218,12 @@ bool GameLayer::handle_event(const moof::event& event)
                        {
                                state_.heroine->animation.startSequence("Flattened");
                                moof::log_info("thump!");
-                               mPunchSound.play();
+                               //mPunchSound.play();
                                return true;
                        }
                        else if (event.key.keysym.sym == SDLK_m)
                        {
-                               mMusic.toggle();
+                               music_->toggle();
                                return true;
                        }
                        else if (event.key.keysym.sym == SDLK_PAGEUP)
@@ -278,7 +280,7 @@ void GameLayer::projection()
 
 void GameLayer::projection(moof::scalar width, moof::scalar height)
 {
-       state_.camera.projection(moof::rad(45.0),
+       state_.camera.projection(moof::rad(60.0),
                                                         width / height,
                                                         SCALAR(1.0), SCALAR(200.0));
 }
This page took 0.020024 seconds and 4 git commands to generate.