SDLPP: animation/movement chagnes

This commit is contained in:
2021-04-24 23:26:27 +02:00
parent 6cfe2046d4
commit ee82430f82
2 changed files with 19 additions and 14 deletions
+6 -3
View File
@@ -63,7 +63,9 @@ public:
virtual void unsetColor();
// per second, relative to window width
void setMovementSpeed( double speed );
void addMovement( int x, int y );
void addMovement( double x, double y );
void setMovement( double x, double y );
Vec2D<double> getMovement();
void resetMovementX();
void resetMovementY();
void clearColided();
@@ -94,7 +96,7 @@ public:
void addAnimationFrame( const SDL_Rect &frame );
void addAnimationFrame( const int x, const int y, const int w,
const int h );
void setAnimationSpeed( const int fps );
void setAnimationSpeed( const double fps );
void pauseAnimation();
void resumeAnimation();
void removeAnimation();
@@ -109,7 +111,7 @@ protected:
std::shared_ptr< Renderer > renderer;
std::shared_ptr< CollisionPolygon > polygon;
double movementSpeed = 0;
Vec2D< int > movementDirection = { 0, 0 };
Vec2D< double > movementDirection = { 0, 0 };
std::vector< std::shared_ptr< RenderObject > > colidedWith;
uint64_t id = -1;
bool hidden = false;
@@ -124,6 +126,7 @@ protected:
size_t animation_index = 0;
size_t animation_fps = 1;
int animation_next_frame = 1000;
int animation_next_frame_base = 0;
std::vector< SDL_Rect > animation{};
bool animating = true;