Exemple #1
0
/**
 * \brief The function that blits the sprite to dst (lowlevel)
 * \param SDL_Surface 	Surface where the sprite will be drawn
 * \param x				X-Coordinate, indicating the position on dst
 * \param y				Y-Coordinate, indicating the position on dst
 */
void CSprite::_drawBlinkingSprite( SDL_Surface *dst, Uint16 x, Uint16 y )
{
	SDL_Rect dst_rect, src_rect;
	dst_rect.x = x;			dst_rect.y = y;
	dst_rect.w = m_xsize;	dst_rect.h = m_ysize;

	src_rect.x = 0;	src_rect.y = 0;
	src_rect.w = dst_rect.w;
	src_rect.h = dst_rect.h;

	SDL_Surface *blanksfc =	SDL_DisplayFormatAlpha(mpSurface.get());
	blitMaskedSprite(blanksfc, mpSurface.get(), 0xFFFFFF);
	SDL_BlitSurface( blanksfc, &src_rect, dst, &dst_rect );
	SDL_FreeSurface(blanksfc);
}
/**
 * \brief The function that blits the sprite to dst (lowlevel)
 * \param SDL_Surface 	Surface where the sprite will be drawn
 * \param x				X-Coordinate, indicating the position on dst
 * \param y				Y-Coordinate, indicating the position on dst
 */
void CSprite::_drawBlinkingSprite( SDL_Surface *dst, Uint16 x, Uint16 y )
{
	SDL_Rect dst_rect, src_rect;
	dst_rect.x = x;			dst_rect.y = y;
	dst_rect.w = m_xsize;	dst_rect.h = m_ysize;

	src_rect.x = 0;	src_rect.y = 0;
	src_rect.w = dst_rect.w;
	src_rect.h = dst_rect.h;

//#if SDL_VERSION_ATLEAST(2, 0, 0)
    
//#else
    SDL_Surface *blanksfc = g_pVideoDriver->convertThroughBlitSfc(mpSurface.get());
	blitMaskedSprite(blanksfc, mpSurface.get(), 0xFFFFFF);
	SDL_BlitSurface( blanksfc, &src_rect, dst, &dst_rect );
	SDL_FreeSurface(blanksfc);
//#endif
}