コード例 #1
0
// 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 );
	}
}
コード例 #2
0
ファイル: Sprite.cpp プロジェクト: Vawx/CaveStory_Remake_SDL
// 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 );
}