*
**************************************************************************/
+#include "../config.h"
+
#include <stdexcept>
#include <moof/log.hh>
#include "GameLayer.hh"
-#if HAVE_CONFIG_H
-#include "config.h"
-#endif
-
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");
}
}
-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);
{
bool isMute = false;
settings().get("nomusic", isMute);
- if (!isMute) mMusic.play();
+ if (!isMute) music_->play();
loadSceneLoader();
advanceScene(settings()); // load the first scene
{
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)
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));
}