Add some collision bars.
This commit is contained in:
parent
cdaffe0f2b
commit
f52476a4ec
4 changed files with 18 additions and 1 deletions
|
@ -28,6 +28,7 @@ namespace cloonel {
|
|||
Character::Character (const std::string& parPath, SDLMain* parMain, float2 parSize) :
|
||||
Placeable(float2(0.0f)),
|
||||
Drawable(parSize),
|
||||
m_bottomBar(float2(0.0f), parSize.x()),
|
||||
m_screenRatio(parMain),
|
||||
m_texture(new Texture(parPath, parMain, false))
|
||||
{
|
||||
|
@ -39,6 +40,7 @@ namespace cloonel {
|
|||
Character::Character (const std::string&& parPath, SDLMain* parMain, float2 parSize) :
|
||||
Placeable(float2(0.0f)),
|
||||
Drawable(parSize),
|
||||
m_bottomBar(float2(0.0f), parSize.x()),
|
||||
m_screenRatio(parMain),
|
||||
m_texture(new Texture(parPath, parMain, false))
|
||||
{
|
||||
|
|
|
@ -24,6 +24,7 @@
|
|||
#include "drawable.hpp"
|
||||
#include "vector.hpp"
|
||||
#include "sizenotifiable.hpp"
|
||||
#include "horzcollisionbar.hpp"
|
||||
#include <string>
|
||||
#include <memory>
|
||||
|
||||
|
@ -42,6 +43,7 @@ namespace cloonel {
|
|||
virtual void Draw ( void ) const;
|
||||
|
||||
private:
|
||||
HorzCollisionBar m_bottomBar;
|
||||
SizeNotifiable<regbehaviours::AutoRegister> m_screenRatio;
|
||||
const std::unique_ptr<Texture> m_texture;
|
||||
};
|
||||
|
|
|
@ -26,6 +26,7 @@ namespace cloonel {
|
|||
///--------------------------------------------------------------------------
|
||||
Platform::Platform (SDLMain* parSdlMain, const float2& parPos, Texture* parTexture, const float2& parSize) :
|
||||
Placeable(parPos),
|
||||
m_collisionTop(parPos, parSize.x()),
|
||||
m_screenRatio(parSdlMain),
|
||||
m_size(parSize),
|
||||
m_surface(parTexture)
|
||||
|
@ -37,6 +38,7 @@ namespace cloonel {
|
|||
///--------------------------------------------------------------------------
|
||||
Platform::Platform (Platform&& parOther) noexcept :
|
||||
Placeable(parOther.GetPos()),
|
||||
m_collisionTop(parOther.m_collisionTop),
|
||||
m_screenRatio(std::move(parOther.m_screenRatio)),
|
||||
m_size(parOther.m_size),
|
||||
m_surface(parOther.m_surface)
|
||||
|
@ -59,4 +61,10 @@ namespace cloonel {
|
|||
m_surface = parOther.m_surface;
|
||||
return *this;
|
||||
}
|
||||
|
||||
///--------------------------------------------------------------------------
|
||||
///--------------------------------------------------------------------------
|
||||
void Platform::OnRegister (Mover& parMover, Mover::PlaceableTicketType parParentTicket) {
|
||||
parMover.RegisterPlaceable(&m_collisionTop, parParentTicket);
|
||||
}
|
||||
} //namespace cloonel
|
||||
|
|
|
@ -23,6 +23,7 @@
|
|||
#include "sizenotifiable.hpp"
|
||||
#include "drawable.hpp"
|
||||
#include "placeable.hpp"
|
||||
#include "horzcollisionbar.hpp"
|
||||
|
||||
namespace cloonel {
|
||||
class Texture;
|
||||
|
@ -36,11 +37,15 @@ namespace cloonel {
|
|||
virtual ~Platform ( void ) noexcept = default;
|
||||
Platform& operator= ( const Platform& parOther );
|
||||
|
||||
virtual void Draw ( void ) const;
|
||||
float2 TopLeft ( void ) const { return GetPos(); }
|
||||
float2 BottomRight ( void ) const { return TopLeft() + m_size; }
|
||||
|
||||
//Overrides
|
||||
virtual void Draw ( void ) const;
|
||||
virtual void OnRegister ( Mover& parMover, Mover::PlaceableTicketType parParentTicket );
|
||||
|
||||
private:
|
||||
HorzCollisionBar m_collisionTop;
|
||||
SizeNotifiable<regbehaviours::AutoRegister> m_screenRatio;
|
||||
float2 m_size;
|
||||
Texture* m_surface;
|
||||
|
|
Loading…
Reference in a new issue