Use the new tree-based registration system in the mover.

This commit is contained in:
King_DuckZ 2014-07-10 20:00:54 +02:00
parent 61f0c28983
commit 9c660caec6
7 changed files with 45 additions and 16 deletions

View file

@ -68,16 +68,17 @@ namespace cloonel {
std::unique_ptr<MoverLeftRight> moverLeftRight(new MoverLeftRight(1.5f, 5.0f, 40.0f));
std::unique_ptr<MoverWorld> moverWorld(new MoverWorld(halfRefHeight));
std::unique_ptr<TiledWallpaper> wallpaper(new TiledWallpaper("resources/graphics/background_tile.png", SDLObject()));
std::unique_ptr<PlatformSystem> platforms(new PlatformSystem("resources/graphics/platform.png", SDLObject(), this, halfRefHeight * 0.9f, *moverWorld));
std::unique_ptr<PlatformSystem> platforms(new PlatformSystem("resources/graphics/platform.png", SDLObject(), this, halfRefHeight * 0.9f));
player->Prepare();
platforms->Prepare();
moverSine->RegisterPlaceable(player.get());
moverSine->RegisterPlaceable(moverWorld.get()); //Keep an invisible mover
moverLeftRight->RegisterPlaceable(player.get());
moverWorld->RegisterPlaceable(player.get()); //It compensates the position when the chara goes over the mid
moverWorld->RegisterPlaceable(moverWorld.get()); //The mover has to be in sync with the character
moverWorld->RegisterPlaceable(platforms.get());
wallpaper->Reload();
platforms->Prepare();
std::swap(moverSine, m_moverSine);
std::swap(player, m_player);