// Draw texture to SDL_Window
void AnimatedSprite::Draw( Graphics &Graphic, int X, int Y )
{
	if ( bVisible )
	{
		SDL_Rect destinationRectangle = { X + m_Offsets[ _CurrentAnimation ].X, 
										  Y + m_Offsets[ _CurrentAnimation ].Y,
										  _DestinationRectangle.w,
										  _DestinationRectangle.h };

		SDL_Rect sourceRectangle = m_Animations[ _CurrentAnimation ][ m_FrameIndex ];
		Graphic.BlitSurface( _SpriteSheet, &sourceRectangle, &destinationRectangle );
	}
}
Exemple #2
0
// Draw sprite to SDL_Window
void Sprite::Draw( Graphics &Graphic, int X, int Y )
{
	_DestinationRectangle.x = X;
	_DestinationRectangle.y = Y;
	Graphic.BlitSurface( _SpriteSheet, &_SourceRectangle, &_DestinationRectangle );
}