本文整理汇总了C++中Surface::GetSurface方法的典型用法代码示例。如果您正苦于以下问题:C++ Surface::GetSurface方法的具体用法?C++ Surface::GetSurface怎么用?C++ Surface::GetSurface使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Surface
的用法示例。
在下文中一共展示了Surface::GetSurface方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: loadItem_
/** @details
* Parsuje XML element a vytváří z něj konkrétní jeden frame.
* @param el XML element <animation_item x,y,(shadow_x, shadow_y)>
* obsahující definici jednoho framu.
* @param width šířka framu animace
* @param height výška framu animace
* @param sur_src zdrojový obrázek, ze kterého se vyřízne frame
* @param sur_shadow_src zdrojový obrýzek, ze kterého se vyřízne stín.
* @see readAttr()
*/
void Animation::loadItem_(TiXmlElement* el, Uint16 width, Uint16 height,
const Surface & sur_src, const Surface & sur_shadow_src){
// atributy pro surface
Uint16 x, y;
readAttr(el, "x", x);
readAttr(el, "y", y);
// vytvorit surface
Surface sur= create_transparent_surface(width, height, false);
SDL_Rect rect={x,y,width,height};
SDL_BlitSurface(sur_src.GetSurface(), &rect, sur.GetSurface(), 0);
frames_.push_back(sur);
if(!draw_shadow_) return;
// atributy pro shadow
readAttr(el, "shadow_x", x);
readAttr(el, "shadow_y", y);
// vytvorit surface
sur= create_transparent_surface(width, height, true);
rect.x=x; rect.y=y;
SDL_BlitSurface(sur_shadow_src.GetSurface(), &rect, sur.GetSurface(), 0);
shadow_frames_.push_back(sur);
}
示例2: Blit
void Surface::Blit(const Surface &surf, SDL_Rect *src, SDL_Rect *dest)
{
int ret = SDL_BlitSurface(surf.GetSurface(), src, surface, dest);
if (ret < 0)
{
throw SDLException("SDL_BlitSurface");
}
}
示例3: DrawSurface
void DrawingArea::DrawSurface(const int x, const int y, const Surface& Surface) {
if (Surface.GetSurface()) { // Check if surface is loaded
SDL_Rect src, dest;
src.x = 0;
src.y = 0;
src.w = Surface.GetSurface()->w;
src.h = Surface.GetSurface()->h;
dest.x = x;
dest.y = y;
dest.w = Surface.GetSurface()->w;
dest.h = Surface.GetSurface()->h;
SDL_BlitSurface(Surface.GetSurface(), &src, this->surface, &dest);
} else {
#ifdef DEBUG
std::cerr << "WARNING: Empty surface would be drawn " << std::endl;
#endif
}
}