clooneljump/src/gameplaysceneclassic.cpp

50 lines
1.7 KiB
C++
Raw Normal View History

#include "gameplaysceneclassic.hpp"
#include "character.hpp"
#include "moversine.hpp"
#include "sdlmain.hpp"
#include <algorithm>
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> moverSine(new MoverSine());
2014-02-22 11:25:16 +00:00
std::unique_ptr<Character> player(new Character("resources/graphics/player.png", SDLObject(), ushort2(80, 120)));
player->Prepare();
player->SwapMover(moverSine.get());
std::swap(moverSine, m_moverSine);
std::swap(player, m_player);
AddMover(m_moverSine.get());
AddDrawable(m_player.get());
m_moverSine->SetPower(static_cast<float>(SDLObject()->DefWidthHeight().y() / 2));
}
///--------------------------------------------------------------------------
///--------------------------------------------------------------------------
void GameplaySceneClassic::Destroy() noexcept {
m_moverSine = std::move(std::unique_ptr<MoverSine>(nullptr));
m_player = std::move(std::unique_ptr<Character>(nullptr));
}
} //namespace cloonel