Generate one platform and draw it. WiP.

This commit is contained in:
King_DuckZ 2014-03-28 10:52:59 +01:00
parent 4aef3a7c84
commit fc50c6af55
5 changed files with 64 additions and 12 deletions

View file

@ -25,6 +25,8 @@
#include "key.hpp"
#include "moverleftright.hpp"
#include "tiledwallpaper.hpp"
#include "texture.hpp"
#include "platformsystem.hpp"
#include <algorithm>
#include <SDL2/SDL_scancode.h>
#include <ciso646>
@ -61,16 +63,19 @@ namespace cloonel {
std::unique_ptr<Character> player(new Character("resources/graphics/player.png", SDLObject(), float2(80.0f, 120.0f)));
std::unique_ptr<MoverLeftRight> moverLeftRight(new MoverLeftRight(1.5f, 5.0f, 40.0f));
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));
player->Prepare();
moverSine->RegisterPlaceable(player.get());
moverLeftRight->RegisterPlaceable(player.get());
wallpaper->Reload();
platforms->Prepare();
std::swap(moverSine, m_moverSine);
std::swap(player, m_player);
std::swap(moverLeftRight, m_moverLeftRight);
std::swap(wallpaper, m_wallpaper);
std::swap(platforms, m_platforms);
AddMover(m_moverSine.get());
AddMover(m_moverLeftRight.get());
@ -87,6 +92,7 @@ namespace cloonel {
m_player = std::move(std::unique_ptr<Character>(nullptr));
m_moverLeftRight = std::move(std::unique_ptr<MoverLeftRight>(nullptr));
m_wallpaper = std::move(std::unique_ptr<TiledWallpaper>(nullptr));
m_platforms = std::move(std::unique_ptr<PlatformSystem>(nullptr));
}
///--------------------------------------------------------------------------
@ -102,5 +108,7 @@ namespace cloonel {
else {
m_moverLeftRight->SetMovement(MoverLeftRight::MovementDirection_Still);
}
m_platforms->SpawnPlatforms();
}
} //namespace cloonel