Refactoring to split the PlatformSystem into a PlatformSet subpart.

Also introduces the same concept for Drawables, with DrawableSet.
Single drawables can't be registered anymore.
This commit is contained in:
King_DuckZ 2014-08-13 22:45:37 +02:00
parent 3c0e460a23
commit 896b368cbe
15 changed files with 393 additions and 99 deletions

View file

@ -21,12 +21,13 @@
#include "placeable.hpp"
#include "collidertypedef.hpp"
#include "collider.hpp"
#include <memory>
namespace cloonel {
class SDLMain;
class GameplayScene;
class Collider;
class DrawableSet;
class PlatformSystem : public Placeable {
public:
@ -34,24 +35,24 @@ namespace cloonel {
PlatformSystem ( const char* parTexturePath, SDLMain* parSDLMain, GameplayScene* parScene, float parMaxDistance );
PlatformSystem ( const PlatformSystem& ) = delete;
PlatformSystem ( PlatformSystem&& parOther ) = delete;
~PlatformSystem ( void ) noexcept;
virtual ~PlatformSystem ( void ) noexcept;
PlatformSystem& operator= ( const PlatformSystem& ) = delete;
void Prepare ( void );
void RegisterForCollision ( ColliderRegisterFunc parReg, ColliderUnregisterFunc parUnreg );
void AddDrawables ( void );
void Destroy ( void ) noexcept;
void SpawnPlatforms ( void );
//Overrides
virtual void OnRegister ( Mover& parOut, Mover::PlaceableTicketType parTicket );
void RegisterForCollision ( Collider& parCollider, Collider::GroupIDType parGroupID );
const DrawableSet* GetDrawableSet ( void ) const;
private:
struct LocalData;
//Overrides
virtual void BeginMovement ( void );
virtual void AddOffset ( const float2& parOffset ) noexcept;
virtual void SetAbsolutePosition ( const float2& ) noexcept;
const std::unique_ptr<LocalData> m_localdata;
ColliderRegisterFunc m_registerToCollider;
ColliderUnregisterFunc m_unregisterFromCollider;
float m_targetAverage;
};
} //namespace cloonel