SDLPP: add option to specify render object alignment
This commit is contained in:
@@ -12,7 +12,14 @@
|
||||
#include <vector>
|
||||
|
||||
namespace SDLPP {
|
||||
class SDLPPSCOPE Scene;
|
||||
|
||||
enum ObjectAlignment {
|
||||
OBJ_START,
|
||||
OBJ_CENTER,
|
||||
OBJ_END,
|
||||
};
|
||||
|
||||
class Scene;
|
||||
|
||||
class SDLPPSCOPE RenderObject {
|
||||
public:
|
||||
@@ -82,10 +89,10 @@ public:
|
||||
virtual void move( int ticks );
|
||||
virtual void custom_move( int ticks ) = 0;
|
||||
virtual void updateSizeAndPosition() = 0;
|
||||
virtual void updateXY();
|
||||
virtual SDL_Rect getRect() = 0;
|
||||
void setPermanent( bool perm = true );
|
||||
bool getPermanent() const;
|
||||
virtual void centerX() = 0;
|
||||
virtual std::shared_ptr< RenderObject > copySelf() = 0;
|
||||
bool isStatic();
|
||||
void setStatic( bool stat = true );
|
||||
@@ -103,6 +110,7 @@ public:
|
||||
void removeAnimation();
|
||||
void animate( int ticks );
|
||||
void visit( Visitor &visitor );
|
||||
void setAlignment( ObjectAlignment horizontal, ObjectAlignment vertical );
|
||||
|
||||
protected:
|
||||
virtual void copyTo( std::shared_ptr< RenderObject > other );
|
||||
@@ -115,6 +123,7 @@ protected:
|
||||
double movementSpeed = 0;
|
||||
Vec2D< double > movementDirection = { 0, 0 };
|
||||
std::vector< std::shared_ptr< RenderObject > > colidedWith;
|
||||
virtual Vec2D< double > computeAlignmentAdditions();
|
||||
uint64_t id = -1;
|
||||
bool hidden = false;
|
||||
bool kill = false;
|
||||
@@ -133,12 +142,14 @@ protected:
|
||||
bool animating = true;
|
||||
|
||||
private:
|
||||
void setSceneID( int id );
|
||||
friend Scene;
|
||||
void setSceneID( int id );
|
||||
|
||||
protected:
|
||||
Vec2D< double > original;
|
||||
Vec2D< double > current;
|
||||
ObjectAlignment _horizontal = OBJ_START;
|
||||
ObjectAlignment _vertical = OBJ_START;
|
||||
};
|
||||
} // end of namespace SDLPP
|
||||
|
||||
|
||||
Reference in New Issue
Block a user