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