本文整理汇总了C++中Surface::Blit方法的典型用法代码示例。如果您正苦于以下问题:C++ Surface::Blit方法的具体用法?C++ Surface::Blit怎么用?C++ Surface::Blit使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Surface
的用法示例。
在下文中一共展示了Surface::Blit方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: LoadZLogo
void LoadZLogo(void)
{
#ifdef BUILD_RELEASE
#ifdef WITH_ZLIB
// SDL logo
if(Settings::Get().ExtGameShowSDL())
{
Display & display = Display::Get();
ZSurface* zlogo = new ZSurface();
if(zlogo->Load(_ptr_0806f690.width, _ptr_0806f690.height, _ptr_0806f690.bpp, _ptr_0806f690.pitch,
_ptr_0806f690.rmask, _ptr_0806f690.gmask, _ptr_0806f690.bmask, _ptr_0806f690.amask, _ptr_0806f690.zdata, sizeof(_ptr_0806f690.zdata)))
{
Surface* logo = zlogo;
// scale logo
if(Settings::Get().QVGA())
{
Surface* small = new Surface();
Surface::ScaleMinifyByTwo(*small, *zlogo);
delete zlogo;
zlogo = NULL;
logo = small;
}
const u32 black = logo->MapRGB(0, 0, 0);
const Point offset((display.w() - logo->w()) / 2, (display.h() - logo->h()) / 2);
u8 ii = 0;
while(ii < 250)
{
logo->Blit(ii, offset.x, offset.y, display);
display.Flip();
display.Fill(black);
ii += 10;
}
DELAY(500);
while(ii > 0)
{
logo->Blit(ii, offset.x, offset.y, display);
display.Flip();
display.Fill(black);
ii -= 10;
}
}
if(zlogo) delete zlogo;
}
#endif
#endif
}
示例2:
void Dialog::FrameBorder::Redraw(const Surface & srcsf, const Rect & srcrt, Surface & dstsf, const Rect & dstrt)
{
const u16 mw = dstrt.w < srcrt.w ? dstrt.w : srcrt.w;
const u16 mh = dstrt.h < srcrt.h ? dstrt.h : srcrt.h;
const u16 cw = mw / 3;
const u16 ch = mh / 3;
const s16 cx = srcrt.x + (srcrt.w - cw) / 2;
const s16 cy = srcrt.y + (srcrt.h - ch) / 2;
const u16 bw = mw - 2 * cw;
const u16 bh = mh - 2 * ch;
const u16 ox = (dstrt.w - (dstrt.w / bw) * bw) / 2;
const u16 oy = (dstrt.h - (dstrt.h / bh) * bh) / 2;
// body
if(bw < dstrt.w && bh < dstrt.h)
for(u16 yy = 0; yy < (dstrt.h / bh); ++yy)
for(u16 xx = 0; xx < (dstrt.w / bw); ++xx)
srcsf.Blit(Rect(cx, cy, bw, bh), dstrt.x + ox + xx * bw, dstrt.y + oy + yy * bh, dstsf);
// top, bottom bar
for(u16 xx = 0; xx < (dstrt.w / bw); ++xx)
{
const s16 dstx = dstrt.x + ox + xx * bw;
srcsf.Blit(Rect(cx, srcrt.y, bw, ch), dstx, dstrt.y, dstsf);
srcsf.Blit(Rect(cx, srcrt.y + srcrt.h - ch, bw, ch), dstx, dstrt.y + dstrt.h - ch, dstsf);
}
// left, right bar
for(u16 yy = 0; yy < (dstrt.h / bh); ++yy)
{
const s16 dsty = dstrt.y + oy + yy * bh;
srcsf.Blit(Rect(srcrt.x, cy, cw, bh), dstrt.x, dsty, dstsf);
srcsf.Blit(Rect(srcrt.x + srcrt.w - cw, cy, cw, bh), dstrt.x + dstrt.w - cw, dsty, dstsf);
}
// top left angle
srcsf.Blit(Rect(srcrt.x, srcrt.y, cw, ch), dstrt.x, dstrt.y, dstsf);
// top right angle
srcsf.Blit(Rect(srcrt.x + srcrt.w - cw, srcrt.y, cw, ch), dstrt.x + dstrt.w - cw, dstrt.y, dstsf);
// bottom left angle
srcsf.Blit(Rect(srcrt.x, srcrt.y + srcrt.h - ch, cw, ch), dstrt.x, dstrt.y + dstrt.h - ch, dstsf);
// bottom right angle
srcsf.Blit(Rect(srcrt.x + srcrt.w - cw, srcrt.y + srcrt.h - ch, cw, ch), dstrt.x + dstrt.w - cw, dstrt.y + dstrt.h - ch, dstsf);
}
示例3: RedrawItem
void RedrawItem(const int & index, s32 dstx, s32 dsty, bool current)
{
Display & display = Display::Get();
Surface port = Heroes::GetPortrait(index, PORT_SMALL);
if(port.isValid())
port.Blit(dstx + 5, dsty + 3, display);
Text text(Heroes::GetName(index), (current ? Font::YELLOW_BIG : Font::BIG));
text.Blit(dstx + 50, dsty + 5);
};
示例4: RedrawResourceInfo
void RedrawResourceInfo(const Surface & sres, const Point & pos, s32 value,
u8 px1, u8 py1, u8 px2, u8 py2)
{
Display & display = Display::Get();
Point dst_pt;
dst_pt.x = pos.x + px1;
dst_pt.y = pos.y + py1;
sres.Blit(dst_pt, display);
Text text(GetString(value), Font::SMALL);
dst_pt.x = pos.x + px2 - text.w() / 2;
dst_pt.y = pos.y + py2;
text.Blit(dst_pt);
}