Animation
This commit is contained in:
@@ -46,12 +46,12 @@ public:
|
||||
int source_y, int source_width,
|
||||
int source_height );
|
||||
virtual void setTexture( const std::shared_ptr< Texture > &t,
|
||||
SDL_Rect source_rect = { -1, -1, -1, -1 } );
|
||||
const SDL_Rect &source_rect = { -1, -1, -1, -1 } );
|
||||
virtual void setTexture( const std::string &img_path, int source_x,
|
||||
int source_y, int source_width,
|
||||
int source_height );
|
||||
virtual void setTexture( const std::string &img_path,
|
||||
SDL_Rect source_rect = { -1, -1, -1, -1 } );
|
||||
const SDL_Rect &source_rect = { -1, -1, -1, -1 } );
|
||||
virtual void setTexture( Font &font, const std::string &text,
|
||||
const std::string &color = "FFFFFF",
|
||||
const std::string &outline_color = "000000",
|
||||
@@ -87,8 +87,17 @@ public:
|
||||
void setStatic( bool stat = true );
|
||||
std::shared_ptr< Renderer > getRenderer() const;
|
||||
void setTextureAlpha( uint8_t alpha );
|
||||
void setTextureSourceRect( SDL_Rect source_rect );
|
||||
void setTextureSourceRect( const SDL_Rect &source_rect );
|
||||
void setTextureSourceRect( int x, int y, int w, int h );
|
||||
void setAnimationFrames( const std::vector< SDL_Rect > &frames );
|
||||
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 pauseAnimation();
|
||||
void resumeAnimation();
|
||||
void removeAnimation();
|
||||
void animate( int ticks );
|
||||
|
||||
protected:
|
||||
virtual void copyTo( std::shared_ptr< RenderObject > other );
|
||||
@@ -111,6 +120,11 @@ protected:
|
||||
bool centerx = false;
|
||||
SDL_Rect rect;
|
||||
SDL_Rect src_rect = { -1, -1, -1, -1 };
|
||||
size_t animation_index = 0;
|
||||
size_t animation_fps = 1;
|
||||
int animation_next_frame = 1000;
|
||||
std::vector< SDL_Rect > animation{};
|
||||
bool animating = true;
|
||||
|
||||
private:
|
||||
void setSceneID( int id );
|
||||
|
||||
Reference in New Issue
Block a user