Add texture alpha blending
This commit is contained in:
@@ -12,7 +12,7 @@ void RenderObject::render() {
|
||||
polygon->render( *renderer );
|
||||
if ( texture != NULL ) {
|
||||
SDL_Rect *src = NULL;
|
||||
if(!entireTexture())
|
||||
if ( !entireTexture() )
|
||||
src = &src_rect;
|
||||
SDL_RenderCopy( renderer->getRendererPtr(),
|
||||
texture->getTexturePtr(), src, &rect );
|
||||
@@ -186,4 +186,13 @@ void RenderObject::copyTo( std::shared_ptr< RenderObject > other ) {
|
||||
}
|
||||
other->colidedWith.clear();
|
||||
}
|
||||
void RenderObject::setTextureAlpha( uint8_t alpha ) {
|
||||
texture->setAlpha( alpha );
|
||||
}
|
||||
void RenderObject::setTextureSourceRect( SDL_Rect source_rect ) {
|
||||
src_rect = source_rect;
|
||||
}
|
||||
void RenderObject::setTextureSourceRect( int x, int y, int w, int h ) {
|
||||
setTextureSourceRect( { x, y, w, h } );
|
||||
}
|
||||
} // namespace SDLPP
|
||||
|
||||
Reference in New Issue
Block a user