X-Git-Url: https://git.dogcows.com/gitweb?p=chaz%2Fyoink;a=blobdiff_plain;f=src%2FYoinkApp.cc;h=d391927d02b364bc1a07c8ba170de838a03a4ad0;hp=a17bf88b1c0ffe84c7ef52a2b966773e434f5ea7;hb=1dd005530930657fd6216edc1dfcfa4c270a81c9;hpb=5fa5f117f28922a7e539a432367960c1a61f837d diff --git a/src/YoinkApp.cc b/src/YoinkApp.cc index a17bf88..d391927 100644 --- a/src/YoinkApp.cc +++ b/src/YoinkApp.cc @@ -109,7 +109,7 @@ YoinkApp::YoinkApp(int argc, char* argv[]) : music("NightFusion"), punchSound("RobotPunch") { - Mf::Dispatcher::getInstance().addHandler("video.context_recreated", + Mf::dispatcher::addHandler("video.context_recreated", boost::bind(&YoinkApp::contextRecreated, this, _1), this); setupGL(); @@ -119,7 +119,7 @@ YoinkApp::YoinkApp(int argc, char* argv[]) : state = 0.0; - heroine = CharacterPtr(new Character("RobotTrooper")); + heroine = Character::alloc("RobotTrooper"); heroine->getAnimation().startSequence("Run"); font = new TilemapFont; @@ -134,7 +134,7 @@ YoinkApp::YoinkApp(int argc, char* argv[]) : Mf::Scalar coeff[2] = {1.0, 0.0}; fadeIn.init(coeff, 0.1); - testScene = new Mf::Scene("Test"); + testScene = Mf::Scene::alloc("Test"); heroine->treeNode = testScene->getOctree()->insert(heroine); } @@ -142,9 +142,8 @@ YoinkApp::~YoinkApp() { //delete heroine; delete font; - delete testScene; - Mf::Dispatcher::getInstance().removeHandler(this); + Mf::dispatcher::removeHandler(this); } @@ -202,6 +201,7 @@ void YoinkApp::update(Mf::Scalar t, Mf::Scalar dt) heroine->update(t, dt); heroine->treeNode = testScene->getOctree()->reinsert(heroine, heroine->treeNode); + testScene->getOctree()->print(heroine->treeNode); //camera.lookAt(heroine->getSphere().point); camera.setPosition(Mf::Vector3(-heroine->current.position[0], -heroine->current.position[1], -256)); @@ -242,6 +242,7 @@ void YoinkApp::draw(Mf::Scalar alpha) //heroine->draw(alpha); + heroine->getAabb().draw(); hud.draw(); @@ -418,7 +419,7 @@ void YoinkApp::handleEvent(const Mf::Event& event) } else if (event.key.keysym.sym == SDLK_t) { - Mf::Dispatcher::getInstance().dispatch("video.context_recreated"); + Mf::dispatcher::dispatch("video.context_recreated"); break; } else if (event.key.keysym.sym == SDLK_p) @@ -469,31 +470,16 @@ int main(int argc, char* argv[]) int status = 0; -//start: try { YoinkApp app(argc, argv); status = app.run(); } - //catch (Mf::Texture::Exception e) - //{ - //std::cout << "Unhandled exception: " << e.what() << std::endl; - //status = 1; - //} catch (Mf::Exception e) { - //std::cout << "Unhandled exception: " << e.what() << std::endl; Mf::logError("unhandled exception: <<%s>>", e.what()); - Mf::logInfo("it's time to crash now ;-("); + Mf::logInfo("it's time to crash now :-("); status = 1; - - //std::cout << "Yoink stopped. Do you want to run it again? [yes/No]" - //<< std::endl; - - //char answer; - //std::cin >> answer; - - //if (answer == 'y' || answer == 'Y') goto start; } std::cout << std::endl << "Goodbye..." << std::endl << std::endl;