SDLPP: add option to get SRC rect of texture

This commit is contained in:
zv0n 2021-05-31 14:01:11 +02:00
parent 3bef592cb1
commit af94cc0e03
2 changed files with 4 additions and 0 deletions

View File

@ -223,6 +223,9 @@ void RenderObject::setTextureSourceRect( const SDL_Rect &source_rect ) {
void RenderObject::setTextureSourceRect( int x, int y, int w, int h ) { void RenderObject::setTextureSourceRect( int x, int y, int w, int h ) {
setTextureSourceRect( { x, y, w, h } ); setTextureSourceRect( { x, y, w, h } );
} }
SDL_Rect RenderObject::getTextureSourceRect() const {
return src_rect;
}
void RenderObject::setAnimationFrames( const std::vector< SDL_Rect > &frames ) { void RenderObject::setAnimationFrames( const std::vector< SDL_Rect > &frames ) {
animation = frames; animation = frames;
} }

View File

@ -111,6 +111,7 @@ public:
void setTextureAlpha( uint8_t alpha ); void setTextureAlpha( uint8_t alpha );
void setTextureSourceRect( const SDL_Rect &source_rect ); void setTextureSourceRect( const SDL_Rect &source_rect );
void setTextureSourceRect( int x, int y, int w, int h ); void setTextureSourceRect( int x, int y, int w, int h );
SDL_Rect getTextureSourceRect() const;
void setAnimationFrames( const std::vector< SDL_Rect > &frames ); void setAnimationFrames( const std::vector< SDL_Rect > &frames );
void addAnimationFrame( const SDL_Rect &frame ); void addAnimationFrame( const SDL_Rect &frame );
void addAnimationFrame( const int x, const int y, const int w, void addAnimationFrame( const int x, const int y, const int w,