New TiledWallpaper class for the background.
This commit is contained in:
parent
83d139d4b5
commit
8d2ddaa9ff
5 changed files with 107 additions and 0 deletions
|
@ -24,6 +24,7 @@
|
|||
#include "inputbag.hpp"
|
||||
#include "key.hpp"
|
||||
#include "moverleftright.hpp"
|
||||
#include "tiledwallpaper.hpp"
|
||||
#include <algorithm>
|
||||
#include <SDL2/SDL_scancode.h>
|
||||
#include <ciso646>
|
||||
|
@ -63,17 +64,21 @@ namespace cloonel {
|
|||
std::unique_ptr<MoverSine> moverSine(new MoverSine());
|
||||
std::unique_ptr<Character> player(new Character("resources/graphics/player.png", SDLObject(), ushort2(80, 120)));
|
||||
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()));
|
||||
|
||||
player->Prepare();
|
||||
moverSine->RegisterPlaceable(player.get());
|
||||
moverLeftRight->RegisterPlaceable(player.get());
|
||||
wallpaper->Reload();
|
||||
|
||||
std::swap(moverSine, m_moverSine);
|
||||
std::swap(player, m_player);
|
||||
std::swap(moverLeftRight, m_moverLeftRight);
|
||||
std::swap(wallpaper, m_wallpaper);
|
||||
|
||||
AddMover(m_moverSine.get());
|
||||
AddMover(m_moverLeftRight.get());
|
||||
AddDrawable(m_wallpaper.get());
|
||||
AddDrawable(m_player.get());
|
||||
|
||||
m_moverSine->SetPower(static_cast<float>(SDLObject()->DefWidthHeight().y() / 2));
|
||||
|
@ -85,6 +90,7 @@ namespace cloonel {
|
|||
m_moverSine = std::move(std::unique_ptr<MoverSine>(nullptr));
|
||||
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));
|
||||
}
|
||||
|
||||
///--------------------------------------------------------------------------
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue