2014-02-21 20:28:34 +00:00
|
|
|
#include "gameplaysceneclassic.hpp"
|
2014-02-21 20:51:56 +00:00
|
|
|
#include "character.hpp"
|
|
|
|
#include "moversine.hpp"
|
2014-02-22 12:13:49 +00:00
|
|
|
#include "sdlmain.hpp"
|
2014-02-21 20:51:56 +00:00
|
|
|
#include <algorithm>
|
2014-02-21 20:28:34 +00:00
|
|
|
|
|
|
|
namespace cloonel {
|
2014-02-21 20:51:56 +00:00
|
|
|
struct GameplaySceneClassic::LocalData {
|
|
|
|
};
|
|
|
|
|
2014-02-21 20:28:34 +00:00
|
|
|
///--------------------------------------------------------------------------
|
|
|
|
///--------------------------------------------------------------------------
|
|
|
|
GameplaySceneClassic::GameplaySceneClassic (SDLMain* parSdlMain) :
|
2014-02-21 20:51:56 +00:00
|
|
|
GameplayScene(parSdlMain),
|
|
|
|
m_local(new LocalData)
|
2014-02-21 20:28:34 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
///--------------------------------------------------------------------------
|
|
|
|
///--------------------------------------------------------------------------
|
|
|
|
GameplaySceneClassic::~GameplaySceneClassic() noexcept {
|
|
|
|
Destroy();
|
|
|
|
}
|
|
|
|
|
|
|
|
///--------------------------------------------------------------------------
|
|
|
|
///--------------------------------------------------------------------------
|
|
|
|
void GameplaySceneClassic::Prepare() {
|
2014-02-21 20:51:56 +00:00
|
|
|
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)));
|
2014-02-21 20:51:56 +00:00
|
|
|
|
|
|
|
player->Prepare();
|
|
|
|
player->SwapMover(moverSine.get());
|
|
|
|
|
|
|
|
std::swap(moverSine, m_moverSine);
|
|
|
|
std::swap(player, m_player);
|
|
|
|
|
|
|
|
AddMover(m_moverSine.get());
|
|
|
|
AddDrawable(m_player.get());
|
2014-02-22 12:13:49 +00:00
|
|
|
|
|
|
|
m_moverSine->SetPower(static_cast<float>(SDLObject()->DefWidthHeight().y() / 2));
|
2014-02-21 20:28:34 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
///--------------------------------------------------------------------------
|
|
|
|
///--------------------------------------------------------------------------
|
|
|
|
void GameplaySceneClassic::Destroy() noexcept {
|
2014-02-21 20:51:56 +00:00
|
|
|
m_moverSine = std::move(std::unique_ptr<MoverSine>(nullptr));
|
|
|
|
m_player = std::move(std::unique_ptr<Character>(nullptr));
|
2014-02-21 20:28:34 +00:00
|
|
|
}
|
|
|
|
} //namespace cloonel
|