Rename PlatformSystem to PlatformSpawner.
This commit is contained in:
parent
896b368cbe
commit
c59a4573f4
5 changed files with 26 additions and 26 deletions
|
@ -98,7 +98,7 @@ add_executable(${PROJECT_NAME}
|
|||
src/horzcollisionbar.cpp
|
||||
src/platform.cpp
|
||||
src/vectormath.cpp
|
||||
src/platformsystem.cpp
|
||||
src/platformspawner.cpp
|
||||
src/movers/moverworld.cpp
|
||||
src/line.cpp
|
||||
src/collider.cpp
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
#include "moverworld.hpp"
|
||||
#include "tiledwallpaper.hpp"
|
||||
#include "texture.hpp"
|
||||
#include "platformsystem.hpp"
|
||||
#include "platformspawner.hpp"
|
||||
#include "CloonelJumpConfig.h"
|
||||
#include <algorithm>
|
||||
#include <SDL2/SDL_scancode.h>
|
||||
|
@ -81,7 +81,7 @@ namespace cloonel {
|
|||
std::unique_ptr<MoverLeftRight> moverLeftRight(new MoverLeftRight(1.5f, 5.0f, 40.0f));
|
||||
std::unique_ptr<MoverWorld> moverWorld(new MoverWorld(halfRefHeight));
|
||||
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, halfRefHeight * 0.9f));
|
||||
std::unique_ptr<PlatformSpawner> platforms(new PlatformSpawner("resources/graphics/platform.png", SDLObject(), this, halfRefHeight * 0.9f));
|
||||
|
||||
player->Prepare();
|
||||
platforms->Prepare();
|
||||
|
@ -128,7 +128,7 @@ namespace cloonel {
|
|||
GameplayScene::Destroy();
|
||||
|
||||
//Destroy in reverse creation order
|
||||
m_platforms = std::move(std::unique_ptr<PlatformSystem>(nullptr));
|
||||
m_platforms = std::move(std::unique_ptr<PlatformSpawner>(nullptr));
|
||||
m_wallpaper = std::move(std::unique_ptr<TiledWallpaper>(nullptr));
|
||||
m_moverWorld = std::move(std::unique_ptr<MoverWorld>(nullptr));
|
||||
m_moverLeftRight = std::move(std::unique_ptr<MoverLeftRight>(nullptr));
|
||||
|
|
|
@ -31,7 +31,7 @@ namespace cloonel {
|
|||
class MoverWorld;
|
||||
class TiledWallpaper;
|
||||
class Texture;
|
||||
class PlatformSystem;
|
||||
class PlatformSpawner;
|
||||
|
||||
class GameplaySceneClassic : public GameplayScene {
|
||||
public:
|
||||
|
@ -49,7 +49,7 @@ namespace cloonel {
|
|||
std::unique_ptr<MoverLeftRight> m_moverLeftRight;
|
||||
std::unique_ptr<MoverWorld> m_moverWorld;
|
||||
std::unique_ptr<TiledWallpaper> m_wallpaper;
|
||||
std::unique_ptr<PlatformSystem> m_platforms;
|
||||
std::unique_ptr<PlatformSpawner> m_platforms;
|
||||
};
|
||||
} //namespace cloonel
|
||||
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
along with CloonelJump. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "platformsystem.hpp"
|
||||
#include "platformspawner.hpp"
|
||||
#include "platform.hpp"
|
||||
#include "CloonelJumpConfig.h"
|
||||
#include "texture.hpp"
|
||||
|
@ -61,7 +61,7 @@ namespace cloonel {
|
|||
}
|
||||
} //unnamed namespace
|
||||
|
||||
struct PlatformSystem::LocalData : public boost::noncopyable {
|
||||
struct PlatformSpawner::LocalData : public boost::noncopyable {
|
||||
LocalData ( const char* parTexturePath, SDLMain* parSDLMain, GameplayScene* parScene, float parMaxDistance );
|
||||
~LocalData ( void ) noexcept = default;
|
||||
|
||||
|
@ -74,7 +74,7 @@ namespace cloonel {
|
|||
|
||||
///--------------------------------------------------------------------------
|
||||
///--------------------------------------------------------------------------
|
||||
PlatformSystem::LocalData::LocalData (const char* parTexturePath, SDLMain* parSDLMain, GameplayScene* parScene, float parMaxDistance) :
|
||||
PlatformSpawner::LocalData::LocalData (const char* parTexturePath, SDLMain* parSDLMain, GameplayScene* parScene, float parMaxDistance) :
|
||||
platforms(parSDLMain),
|
||||
texture(parTexturePath, parSDLMain, false),
|
||||
scene(parScene),
|
||||
|
@ -84,7 +84,7 @@ namespace cloonel {
|
|||
|
||||
///--------------------------------------------------------------------------
|
||||
///--------------------------------------------------------------------------
|
||||
PlatformSystem::PlatformSystem (const char* parTexturePath, SDLMain* parSDLMain, GameplayScene* parScene, float parMaxDistance) :
|
||||
PlatformSpawner::PlatformSpawner (const char* parTexturePath, SDLMain* parSDLMain, GameplayScene* parScene, float parMaxDistance) :
|
||||
Placeable(float2(0.0f)),
|
||||
m_localdata(new LocalData(parTexturePath, parSDLMain, parScene, parMaxDistance)),
|
||||
m_targetAverage(parMaxDistance / 5.25f) //TODO: change this value to make up for the difficulty
|
||||
|
@ -93,13 +93,13 @@ namespace cloonel {
|
|||
|
||||
///--------------------------------------------------------------------------
|
||||
///--------------------------------------------------------------------------
|
||||
PlatformSystem::~PlatformSystem() noexcept {
|
||||
PlatformSpawner::~PlatformSpawner() noexcept {
|
||||
Destroy();
|
||||
}
|
||||
|
||||
///--------------------------------------------------------------------------
|
||||
///--------------------------------------------------------------------------
|
||||
void PlatformSystem::SpawnPlatforms() {
|
||||
void PlatformSpawner::SpawnPlatforms() {
|
||||
const float2 platfWH(static_cast<float>(g_platfWidth), static_cast<float>(g_platfHeight));
|
||||
|
||||
size_t freePlatforms = m_localdata->platforms.CountFreePlatforms();
|
||||
|
@ -122,7 +122,7 @@ namespace cloonel {
|
|||
|
||||
///--------------------------------------------------------------------------
|
||||
///--------------------------------------------------------------------------
|
||||
void PlatformSystem::Prepare() {
|
||||
void PlatformSpawner::Prepare() {
|
||||
m_localdata->texture.Reload();
|
||||
|
||||
//Spawn the initial platforms
|
||||
|
@ -132,7 +132,7 @@ namespace cloonel {
|
|||
|
||||
///--------------------------------------------------------------------------
|
||||
///--------------------------------------------------------------------------
|
||||
void PlatformSystem::Destroy() noexcept {
|
||||
void PlatformSpawner::Destroy() noexcept {
|
||||
m_localdata->texture.Destroy();
|
||||
for (const auto& unregPair : m_localdata->registeredTo) {
|
||||
unregPair.second->UnregisterBarSet(unregPair.first, &m_localdata->platforms);
|
||||
|
@ -144,31 +144,31 @@ namespace cloonel {
|
|||
|
||||
///--------------------------------------------------------------------------
|
||||
///--------------------------------------------------------------------------
|
||||
void PlatformSystem::BeginMovement() {
|
||||
void PlatformSpawner::BeginMovement() {
|
||||
m_localdata->platforms.SendBeginMovement();
|
||||
}
|
||||
|
||||
///--------------------------------------------------------------------------
|
||||
///--------------------------------------------------------------------------
|
||||
void PlatformSystem::AddOffset (const float2& parOffset) noexcept {
|
||||
void PlatformSpawner::AddOffset (const float2& parOffset) noexcept {
|
||||
m_localdata->platforms.SendAddOffset(parOffset);
|
||||
}
|
||||
|
||||
///--------------------------------------------------------------------------
|
||||
///--------------------------------------------------------------------------
|
||||
void PlatformSystem::SetAbsolutePosition (const float2&) noexcept {
|
||||
void PlatformSpawner::SetAbsolutePosition (const float2&) noexcept {
|
||||
assert(false);
|
||||
}
|
||||
|
||||
///--------------------------------------------------------------------------
|
||||
///--------------------------------------------------------------------------
|
||||
void PlatformSystem::RegisterForCollision (Collider& parCollider, Collider::GroupIDType parGroupID) {
|
||||
void PlatformSpawner::RegisterForCollision (Collider& parCollider, Collider::GroupIDType parGroupID) {
|
||||
parCollider.RegisterBarSet(parGroupID, &m_localdata->platforms);
|
||||
}
|
||||
|
||||
///--------------------------------------------------------------------------
|
||||
///--------------------------------------------------------------------------
|
||||
const DrawableSet* PlatformSystem::GetDrawableSet() const {
|
||||
const DrawableSet* PlatformSpawner::GetDrawableSet() const {
|
||||
return &m_localdata->platforms;
|
||||
}
|
||||
} //namespace cloonel
|
|
@ -29,14 +29,14 @@ namespace cloonel {
|
|||
class GameplayScene;
|
||||
class DrawableSet;
|
||||
|
||||
class PlatformSystem : public Placeable {
|
||||
class PlatformSpawner : public Placeable {
|
||||
public:
|
||||
PlatformSystem ( void ) = delete;
|
||||
PlatformSystem ( const char* parTexturePath, SDLMain* parSDLMain, GameplayScene* parScene, float parMaxDistance );
|
||||
PlatformSystem ( const PlatformSystem& ) = delete;
|
||||
PlatformSystem ( PlatformSystem&& parOther ) = delete;
|
||||
virtual ~PlatformSystem ( void ) noexcept;
|
||||
PlatformSystem& operator= ( const PlatformSystem& ) = delete;
|
||||
PlatformSpawner ( void ) = delete;
|
||||
PlatformSpawner ( const char* parTexturePath, SDLMain* parSDLMain, GameplayScene* parScene, float parMaxDistance );
|
||||
PlatformSpawner ( const PlatformSpawner& ) = delete;
|
||||
PlatformSpawner ( PlatformSpawner&& parOther ) = delete;
|
||||
virtual ~PlatformSpawner ( void ) noexcept;
|
||||
PlatformSpawner& operator= ( const PlatformSpawner& ) = delete;
|
||||
|
||||
void Prepare ( void );
|
||||
void Destroy ( void ) noexcept;
|
Loading…
Reference in a new issue