本文整理汇总了C++中Video::BlitGameSprite方法的典型用法代码示例。如果您正苦于以下问题:C++ Video::BlitGameSprite方法的具体用法?C++ Video::BlitGameSprite怎么用?C++ Video::BlitGameSprite使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Video
的用法示例。
在下文中一共展示了Video::BlitGameSprite方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: DrawInternal
/** Draws the Control on the Output Display */
void Button::DrawInternal(Region& rgn)
{
Video * video = core->GetVideoDriver();
// Button image
if (!( Flags & IE_GUI_BUTTON_NO_IMAGE )) {
Sprite2D* Image = NULL;
switch (State) {
case IE_GUI_BUTTON_UNPRESSED:
case IE_GUI_BUTTON_LOCKED:
case IE_GUI_BUTTON_LOCKED_PRESSED:
Image = buttonImages[BUTTON_IMAGE_UNPRESSED];
break;
case IE_GUI_BUTTON_FAKEPRESSED:
case IE_GUI_BUTTON_PRESSED:
Image = buttonImages[BUTTON_IMAGE_PRESSED];
break;
case IE_GUI_BUTTON_SELECTED:
Image = buttonImages[BUTTON_IMAGE_SELECTED];
break;
case IE_GUI_BUTTON_DISABLED:
case IE_GUI_BUTTON_FAKEDISABLED:
Image = buttonImages[BUTTON_IMAGE_DISABLED];
break;
}
if (!Image) {
Image = buttonImages[BUTTON_IMAGE_UNPRESSED];
}
if (Image) {
// FIXME: maybe it's useless...
int xOffs = ( Width / 2 ) - ( Image->Width / 2 );
int yOffs = ( Height / 2 ) - ( Image->Height / 2 );
video->BlitSprite( Image, rgn.x + xOffs, rgn.y + yOffs, true );
}
}
if (State == IE_GUI_BUTTON_PRESSED) {
//shift the writing/border a bit
rgn.x += PushOffset.x;
rgn.y += PushOffset.y;
}
// Button picture
if (AnimPicture) {
int xOffs = ( Width / 2 ) - ( AnimPicture->Width / 2 );
int yOffs = ( Height / 2 ) - ( AnimPicture->Height / 2 );
Region r( rgn.x + xOffs, rgn.y + yOffs, (int)(AnimPicture->Width * Clipping), AnimPicture->Height );
if (Flags & IE_GUI_BUTTON_CENTER_PICTURES) {
video->BlitSprite( AnimPicture, rgn.x + xOffs + AnimPicture->XPos, rgn.y + yOffs + AnimPicture->YPos, true, &r );
} else {
video->BlitSprite( AnimPicture, rgn.x + xOffs, rgn.y + yOffs, true, &r );
}
}
// Button picture
int picXPos = 0, picYPos = 0;
if (Picture && (Flags & IE_GUI_BUTTON_PICTURE) ) {
// Picture is drawn centered
picXPos = ( rgn.w / 2 ) - ( Picture->Width / 2 ) + rgn.x;
picYPos = ( rgn.h / 2 ) - ( Picture->Height / 2 ) + rgn.y;
if (Flags & IE_GUI_BUTTON_HORIZONTAL) {
picXPos += Picture->XPos;
picYPos += Picture->YPos;
// Clipping: 0 = overlay over full button, 1 = no overlay
int overlayHeight = Picture->Height * (1.0 - Clipping);
if (overlayHeight < 0)
overlayHeight = 0;
if (overlayHeight >= Picture->Height)
overlayHeight = Picture->Height;
int buttonHeight = Picture->Height - overlayHeight;
Region rb = Region(picXPos, picYPos, Picture->Width, buttonHeight);
Region ro = Region(picXPos, picYPos + buttonHeight, Picture->Width, overlayHeight);
video->BlitSprite( Picture, picXPos, picYPos, true, &rb );
// TODO: Add an option to add BLIT_GREY to the flags
video->BlitGameSprite( Picture, picXPos, picYPos, BLIT_TINTED, SourceRGB, 0, 0, &ro, true);
// do NOT uncomment this, you can't change Changed or invalidate things from
// the middle of Window::DrawWindow() -- it needs moving to somewhere else
//CloseUpColor();
}
else {
Region r( picXPos, picYPos, (int)(Picture->Width * Clipping), Picture->Height );
video->BlitSprite( Picture, picXPos + Picture->XPos, picYPos + Picture->YPos, true, &r );
}
}
// Composite pictures (paperdolls/description icons)
if (!PictureList.empty() && (Flags & IE_GUI_BUTTON_PICTURE) ) {
std::list<Sprite2D*>::iterator iter = PictureList.begin();
int xOffs = 0, yOffs = 0;
if (Flags & IE_GUI_BUTTON_CENTER_PICTURES) {
// Center the hotspots of all pictures
//.........这里部分代码省略.........
示例2: Draw
//it is not sure if we need tint at all
bool ScriptedAnimation::Draw(const Region &screen, const Point &Pos, const Color &p_tint, Map *area, int dither, int orientation, int height)
{
if (FaceTarget) {
SetOrientation(orientation);
}
// not sure
if (twin) {
twin->Draw(screen, Pos, p_tint, area, dither, -1, height);
}
Video *video = core->GetVideoDriver();
Sprite2D* frame;
if (HandlePhase(frame)) {
//expired
return true;
}
//delayed
if (justCreated) {
return false;
}
ieDword flag = BLIT_TRANSSHADOW;
//transferring flags to SDLdriver, this will have to be consolidated later
if (Transparency & IE_VVC_TRANSPARENT) {
flag |= BLIT_HALFTRANS;
}
Color tint = Tint;
//darken, greyscale, red tint are probably not needed if the global tint works
//these are used in the original engine to implement weather/daylight effects
//on the other hand
if (Transparency & IE_VVC_GREYSCALE) {
flag |= BLIT_GREY;
}
if (Transparency & IE_VVC_SEPIA) {
flag |= BLIT_SEPIA;
}
if (Transparency & BLIT_TINTED) {
flag |= BLIT_TINTED;
}
if ((Transparency & IE_VVC_TINT)==IE_VVC_TINT) {
tint = p_tint;
}
int cx = Pos.x + XPos;
int cy = Pos.y - ZPos + YPos;
if (SequenceFlags&IE_VVC_HEIGHT) cy-=height;
if( SequenceFlags&IE_VVC_NOCOVER) {
if (cover) SetSpriteCover(NULL);
} else {
if (!cover || (Dither!=dither) || (!cover->Covers(cx, cy, frame->XPos, frame->YPos, frame->Width, frame->Height)) ) {
Dither = dither;
Animation *anim = anims[Phase*MAX_ORIENT+Orientation];
SetSpriteCover(area->BuildSpriteCover(cx, cy, -anim->animArea.x,
-anim->animArea.y, anim->animArea.w, anim->animArea.h, dither) );
}
assert(cover->Covers(cx, cy, frame->XPos, frame->YPos, frame->Width, frame->Height));
}
video->BlitGameSprite( frame, cx + screen.x, cy + screen.y, flag, tint, cover, palette, &screen);
if (light) {
video->BlitGameSprite( light, cx + screen.x, cy + screen.y, 0, tint, NULL, NULL, &screen);
}
return false;
}