#include "gameplaysceneclassic.hpp" #include "character.hpp" #include "moversine.hpp" #include "sdlmain.hpp" #include namespace cloonel { struct GameplaySceneClassic::LocalData { }; ///-------------------------------------------------------------------------- ///-------------------------------------------------------------------------- GameplaySceneClassic::GameplaySceneClassic (SDLMain* parSdlMain) : GameplayScene(parSdlMain), m_local(new LocalData) { } ///-------------------------------------------------------------------------- ///-------------------------------------------------------------------------- GameplaySceneClassic::~GameplaySceneClassic() noexcept { Destroy(); } ///-------------------------------------------------------------------------- ///-------------------------------------------------------------------------- void GameplaySceneClassic::Prepare() { std::unique_ptr moverSine(new MoverSine()); std::unique_ptr player(new Character("resources/graphics/player.png", SDLObject(), ushort2(80, 120))); player->Prepare(); moverSine->RegisterPlaceable(player.get()); std::swap(moverSine, m_moverSine); std::swap(player, m_player); AddMover(m_moverSine.get()); AddDrawable(m_player.get()); m_moverSine->SetPower(static_cast(SDLObject()->DefWidthHeight().y() / 2)); } ///-------------------------------------------------------------------------- ///-------------------------------------------------------------------------- void GameplaySceneClassic::Destroy() noexcept { m_moverSine = std::move(std::unique_ptr(nullptr)); m_player = std::move(std::unique_ptr(nullptr)); } } //namespace cloonel