本文整理汇总了C++中Video::BlitSpriteRegion方法的典型用法代码示例。如果您正苦于以下问题:C++ Video::BlitSpriteRegion方法的具体用法?C++ Video::BlitSpriteRegion怎么用?C++ Video::BlitSpriteRegion使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Video
的用法示例。
在下文中一共展示了Video::BlitSpriteRegion方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: PrintInitial
int Font::PrintInitial(int x, int y, const Region &rgn, unsigned char currChar) const
{
Video *video = core->GetVideoDriver();
video->BlitSpriteRegion( sprBuffer, size[currChar],
x + rgn.x, y + rgn.y - yPos[currChar], true, &rgn );
x += size[currChar].w;
return x;
}
示例2: PrintInitial
int Font::PrintInitial(int x, int y, const Region &rgn, unsigned char currChar) const
{
Video *video = core->GetVideoDriver();
video->BlitSpriteRegion( sprBuffer, getInfo(currChar).size,
x + rgn.x, y + rgn.y - getInfo(currChar).yPos, true, &rgn );
x += getInfo(currChar).size.w;
return x;
}
示例3: Print
//.........这里部分代码省略.........
x = ( rgn.w - w ) / 2;
} else if (Alignment & IE_FONT_ALIGN_RIGHT) {
int w = CalcStringWidth( tmp, NoColor );
x = ( rgn.w - w );
}
if (Alignment & IE_FONT_ALIGN_MIDDLE) {
int h = 0;
for (size_t i = 0; i <= len; i++) {
if (tmp[i] == 0)
h++;
}
h = h * ystep;
y += ( rgn.h - h ) / 2;
} else if (Alignment & IE_FONT_ALIGN_BOTTOM) {
int h = 1;
for (size_t i = 0; i <= len; i++) {
if (tmp[i] == 0)
h++;
}
h = h * ystep;
y += ( rgn.h - h );
} else if (Alignment & IE_FONT_ALIGN_TOP) {
y += 5;
}
for (size_t i = 0; i < len; i++) {
if (( ( unsigned char ) tmp[i] ) == '[' && !NoColor) {
i++;
char tag[256];
tag[0]=0;
for (int k = 0; k < 256 && i<len; k++) {
if (tmp[i] == ']') {
tag[k] = 0;
break;
}
tag[k] = tmp[i++];
}
if (strnicmp( tag, "capital=",8)==0) {
sscanf( tag, "capital=%d", &capital);
if (capital) {
enablecap=true;
}
continue;
}
if (strnicmp( tag, "color=", 6 ) == 0) {
unsigned int r,g,b;
if (sscanf( tag, "color=%02X%02X%02X", &r, &g, &b ) != 3)
continue;
const Color c = {(unsigned char) r,(unsigned char) g,(unsigned char) b, 0};
Palette* newPal = core->CreatePalette( c, palette->back );
sprBuffer->SetPalette( newPal );
gamedata->FreePalette( newPal );
continue;
}
if (stricmp( tag, "/color" ) == 0) {
sprBuffer->SetPalette( pal );
continue;
}
if (stricmp( "p", tag ) == 0) {
psx = x;
continue;
}
if (stricmp( "/p", tag ) == 0) {
psx = PARAGRAPH_START_X;
continue;
}
continue;
}
if (tmp[i] == 0) {
y += ystep;
x = psx;
int w = CalcStringWidth( &tmp[i + 1], NoColor );
if (Alignment & IE_FONT_ALIGN_CENTER) {
x = ( rgn.w - w ) / 2;
} else if (Alignment & IE_FONT_ALIGN_RIGHT) {
x = ( rgn.w - w );
}
continue;
}
unsigned char currChar = ( unsigned char ) tmp[i] - 1;
if (initials && capital) {
x = initials->PrintInitial( x, y, rgn, currChar );
enablecap=false;
continue;
}
video->BlitSpriteRegion( sprBuffer, size[currChar],
x + rgn.x, y + rgn.y - yPos[currChar],
anchor, &cliprgn );
if (cursor && ( curpos == i ))
video->BlitSprite( cursor, x + rgn.x, y + rgn.y, anchor, &cliprgn );
x += size[currChar].w;
}
if (cursor && ( curpos == len )) {
video->BlitSprite( cursor, x + rgn.x, y + rgn.y, anchor, &cliprgn );
}
free( tmp );
}
示例4: PrintFromLine
//.........这里部分代码省略.........
for (int k = 0; k < 256 && i<len; k++) {
if (tmp[i] == ']') {
tag[k] = 0;
break;
}
tag[k] = tmp[i++];
}
if (strnicmp( tag, "capital=",8)==0) {
sscanf( tag, "capital=%d", &capital);
if (capital && (row>=startrow) ) {
enablecap=true;
}
continue;
}
if (strnicmp( tag, "color=", 6 ) == 0) {
unsigned int r,g,b;
if (sscanf( tag, "color=%02X%02X%02X", &r, &g, &b ) != 3)
continue;
const Color c = {(unsigned char) r,(unsigned char)g, (unsigned char)b, 0};
Palette* newPal = core->CreatePalette( c, palette->back );
sprBuffer->SetPalette( newPal );
gamedata->FreePalette( newPal );
continue;
}
if (stricmp( tag, "/color" ) == 0) {
sprBuffer->SetPalette( pal );
continue;
}
if (stricmp( "p", tag ) == 0) {
psx = x;
continue;
}
if (stricmp( "/p", tag ) == 0) {
psx = PARAGRAPH_START_X;
}
continue;
}
if (row < startrow) {
if (tmp[i] == 0) {
row++;
}
continue;
}
if (( tmp[i] == 0 ) || ( tmp[i] == '\n' )) {
y += ystep;
x = psx;
int w = CalcStringWidth( &tmp[i + 1], NoColor );
if (initials_rows > 0) {
initials_rows--;
x += initials_x;
w += initials_x;
}
if (Alignment & IE_FONT_ALIGN_CENTER) {
x = ( rgn.w - w ) / 2;
} else if (Alignment & IE_FONT_ALIGN_RIGHT) {
x = ( rgn.w - w );
}
continue;
}
unsigned char currChar = ( unsigned char ) tmp[i] - 1;
if (initials && capital && enablecap) {
currCap = currChar;
x = initials->PrintInitial( x, y, rgn, currChar );
initials_x = x;
//how many more lines to be indented (one was already indented)
initials_rows = (initials->maxHeight-1)/maxHeight;
initials_row = row;
last_initial_row = initials_row;
enablecap = false;
continue;
} else if(initials && currCap && row > last_initial_row && (row - num_empty_rows - initials_row) <= ((initials->maxHeight-1)/maxHeight)) {
// means this row doesnt have a cap, but a preceeding one did and its overlapping this row
int initY = y;
if (!num_empty_rows) {// num_empty_rows is for scrolling text areas
initY = (y - (maxHeight * (row - initials_row)));
}
x = initials->PrintInitial( x, initY, rgn, currCap );
initials_x = x;
x += psx;
last_initial_row++;
}
video->BlitSpriteRegion( sprBuffer, size[currChar],
x + rgn.x, y + rgn.y - yPos[currChar], true, &rgn );
if (cursor && ( i == curpos )) {
video->BlitSprite( cursor, x + rgn.x,
y + rgn.y, true, &rgn );
}
x += size[currChar].w;
}
if (cursor && ( curpos == len )) {
video->BlitSprite( cursor, x + rgn.x,
y + rgn.y, true, &rgn );
}
free( tmp );
}
示例5: PrintFromLine
//.........这里部分代码省略.........
} else if (Alignment & IE_FONT_ALIGN_TOP) {
y += 5;
}
Video* video = core->GetVideoDriver();
int row = 0;
for (size_t i = 0; i < len; i++) {
if (( ( unsigned char ) tmp[i] ) == '[' && !NoColor) {
i++;
char tag[256];
tag[0]=0;
for (int k = 0; k < 256 && i<len; k++) {
if (tmp[i] == ']') {
tag[k] = 0;
break;
}
tag[k] = tmp[i++];
}
if (strnicmp( tag, "capital=",8)==0) {
sscanf( tag, "capital=%d", &capital);
if (capital && (row>=startrow) ) {
enablecap=true;
}
continue;
}
if (strnicmp( tag, "color=", 6 ) == 0) {
unsigned int r,g,b;
if (sscanf( tag, "color=%02X%02X%02X", &r, &g, &b ) != 3)
continue;
const Color c = {(unsigned char) r,(unsigned char)g, (unsigned char)b, 0};
Palette* newPal = core->CreatePalette( c, palette->back );
sprBuffer->SetPalette( newPal );
gamedata->FreePalette( newPal );
continue;
}
if (stricmp( tag, "/color" ) == 0) {
sprBuffer->SetPalette( pal );
continue;
}
if (stricmp( "p", tag ) == 0) {
psx = x;
continue;
}
if (stricmp( "/p", tag ) == 0) {
psx = PARAGRAPH_START_X;
}
continue;
}
if (row < startrow) {
if (tmp[i] == 0) {
row++;
}
continue;
}
if (( tmp[i] == 0 ) || ( tmp[i] == '\n' )) {
y += ystep;
x = psx;
int w = CalcStringWidth( &tmp[i + 1], NoColor );
if (initials_rows > 0) {
initials_rows--;
x += initials_x;
w += initials_x;
}
if (Alignment & IE_FONT_ALIGN_CENTER) {
x = ( rgn.w - w ) / 2;
} else if (Alignment & IE_FONT_ALIGN_RIGHT) {
x = ( rgn.w - w );
}
continue;
}
unsigned char currChar = ( unsigned char ) tmp[i] - 1;
if (initials && capital && enablecap) {
x = initials->PrintInitial( x, y, rgn, currChar );
initials_x = x;
//how many more lines to be indented (one was already indented)
initials_rows = (initials->maxHeight-1)/maxHeight;
enablecap = false;
continue;
}
video->BlitSpriteRegion( sprBuffer, size[currChar],
x + rgn.x, y + rgn.y - yPos[currChar], true, &rgn );
if (cursor && ( i == curpos )) {
video->BlitSprite( cursor, x + rgn.x,
y + rgn.y, true, &rgn );
}
x += size[currChar].w;
}
if (cursor && ( curpos == len )) {
video->BlitSprite( cursor, x + rgn.x,
y + rgn.y, true, &rgn );
}
free( tmp );
}