X-Git-Url: https://git.dogcows.com/gitweb?p=chaz%2Fyoink;a=blobdiff_plain;f=src%2FGameLayer.cc;h=c0d35b95dadb692b085ee1d9d08bb76765800c25;hp=0498182a9888b22eaac118a55f26b16df2025f86;hb=1fb5f7e36af1a4de040bc2989133703b0e0d4a9f;hpb=831f04d4bc19a390415ac0bbac4331c7a65509bc diff --git a/src/GameLayer.cc b/src/GameLayer.cc index 0498182..c0d35b9 100644 --- a/src/GameLayer.cc +++ b/src/GameLayer.cc @@ -9,6 +9,8 @@ * **************************************************************************/ +#include "config.h" + #include #include @@ -19,18 +21,14 @@ #include "GameLayer.hh" -#if HAVE_CONFIG_H -#include "config.h" -#endif - void GameLayer::loadSceneLoader() { state_.script.import_standard_libraries(); moof::log::import(state_.script); - std::string path("loader"); - if (!Scene::find_path(path)) + std::string path = moof::resource::find_file("scenes/loader.lua"); + if (path.empty()) { throw std::runtime_error("cannot find scene loader script"); } @@ -79,14 +77,13 @@ void GameLayer::advanceScene(moof::settings& settings) } -GameLayer::GameLayer() : - mMusic("NightFusionIntro"), - mPunchSound("Thump") +GameLayer::GameLayer() { - mMusic.loop(true); - mMusic.enqueue("NightFusionLoop"); - - //mMusic.setPosition(moof::vector3(10.0, 5.0, 0.0)); + moof::log_info("about to load sound resource..."); + 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); @@ -95,6 +92,8 @@ GameLayer::GameLayer() : state_.heroine->animation.startSequence("FlyDiagonallyUp"); state_.interp.init(0.0, 1.0, 4.0, moof::lerp_scalar::oscillate); + + sceneMesh = moof::resource::load("classic.ac"); } @@ -102,7 +101,7 @@ void GameLayer::did_add_to_view() { bool isMute = false; settings().get("nomusic", isMute); - if (!isMute) mMusic.play(); + music_.stream(); loadSceneLoader(); advanceScene(settings()); // load the first scene @@ -190,12 +189,13 @@ 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); - state_.scene->draw_if_visible(alpha, state_.camera.frustum()); + //state_.scene->draw_if_visible(alpha, state_.camera.frustum()); + sceneMesh->draw(alpha); state_.heroine->draw(alpha); mRay.draw(); @@ -216,12 +216,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) { - mMusic.toggle(); + music_.toggle(); return true; } else if (event.key.keysym.sym == SDLK_PAGEUP) @@ -278,7 +278,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)); }