本文整理汇总了C++中CBitmap::AddFlags方法的典型用法代码示例。如果您正苦于以下问题:C++ CBitmap::AddFlags方法的具体用法?C++ CBitmap::AddFlags怎么用?C++ CBitmap::AddFlags使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CBitmap
的用法示例。
在下文中一共展示了CBitmap::AddFlags方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: UnloadTextures
void UnloadTextures (void)
{
int i, bD1;
CBitmap *bmP;
#if TRACE
console.printf (CON_VERBOSE, "Unloading textures\n");
#endif
gameData.pig.tex.bPageFlushed++;
TexMergeClose ();
RLECacheFlush ();
for (bD1 = 0; bD1 < 2; bD1++) {
bitmapCacheNext [bD1] = 0;
for (i = 0, bmP = gameData.pig.tex.bitmaps [bD1].Buffer ();
i < gameData.pig.tex.nBitmaps [bD1];
i++, bmP++) {
#if DBG
if (i == nDbgTexture)
nDbgTexture = nDbgTexture;
#endif
if (bitmapOffsets [bD1][i] > 0) { // only page out bitmaps read from disk
bmP->AddFlags (BM_FLAG_PAGED_OUT);
gameData.pig.tex.bitmaps [bD1][i].Unload (i, bD1);
}
}
}
for (i = 0; i < MAX_ADDON_BITMAP_FILES; i++)
gameData.pig.tex.addonBitmaps [i].Unload (i, 0);
}
示例2: DrawString
int CFont::DrawString (int left, int top, const char *s)
{
const char* textP, * nextRowP, * text_ptr1;
int width, spacing, letter;
int x, y;
int origColor = CCanvas::Current ()->FontColor (0).index; //to allow easy reseting to default string color with colored strings -MPM
float fScale = fontManager.Scale ();
ubyte c;
CBitmap* bmf;
tCanvasColor* colorP = (m_info.flags & FT_COLOR) ? NULL : &CCanvas::Current ()->FontColor (0);
if (CCanvas::Current ()->Mode () != BM_OGL)
return -1;
nextRowP = s;
y = top;
if (screen.Canvas ()->Mode () != BM_OGL)
Error ("carp.\n");
while (nextRowP != NULL) {
text_ptr1 = nextRowP;
nextRowP = NULL;
textP = text_ptr1;
x = (left == 0x8000) ? fontManager.Current ()->GetCenteredX (textP) : left;
while ((c = *textP)) {
if (c == '\n') {
nextRowP = textP + 1;
y += m_info.height + 2;
break;
}
letter = c - m_info.minChar;
fontManager.Current ()->GetCharWidth (c, textP [1], width, spacing);
if (c <= 0x06) { //not in font, draw as space
textP = ScanEmbeddedColors (c, textP, origColor, 128, 2);
continue;
}
if (fontManager.Current ()->InFont (letter)) {
bmf = m_info.bitmaps + letter;
bmf->AddFlags (BM_FLAG_TRANSPARENT);
bmf->RenderScaled (x, y, int (bmf->Width () * fScale), int (bmf->Height () * fScale), I2X (1), 0, colorP);
}
x += spacing;
textP++;
}
}
return 0;
}
示例3: LoadReplacementBitmaps
void LoadReplacementBitmaps (const char *pszLevelName)
{
char szFilename [SHORT_FILENAME_LEN];
CFile cf;
int i, j;
CBitmap bm;
//first, free up data allocated for old bitmaps
PrintLog (" loading replacement textures\n");
CFile::ChangeFilenameExtension (szFilename, pszLevelName, ".pog");
if (cf.Open (szFilename, gameFolders.szDataDir, "rb", 0)) {
int id, version, nBitmapNum, bTGA;
int bmDataSize, bmDataOffset, bmOffset;
ushort *indices;
tPIGBitmapHeader *bmh;
id = cf.ReadInt ();
version = cf.ReadInt ();
if (id != MAKE_SIG ('G','O','P','D') || version != 1) {
cf.Close ();
return;
}
nBitmapNum = cf.ReadInt ();
indices = new ushort [nBitmapNum];
bmh = new tPIGBitmapHeader [nBitmapNum];
#if 0
cf.Read (indices, nBitmapNum * sizeof (ushort), 1);
cf.Read (bmh, nBitmapNum * sizeof (tPIGBitmapHeader), 1);
#else
for (i = 0; i < nBitmapNum; i++)
indices [i] = cf.ReadShort ();
for (i = 0; i < nBitmapNum; i++)
PIGBitmapHeaderRead (bmh + i, cf);
#endif
bmDataOffset = cf.Tell ();
bmDataSize = cf.Length () - bmDataOffset;
for (i = 0; i < nBitmapNum; i++) {
bmOffset = bmh [i].offset;
memset (&bm, 0, sizeof (CBitmap));
bm.AddFlags (bmh [i].flags & (BM_FLAGS_TO_COPY | BM_FLAG_TGA));
bm.SetWidth (bmh [i].width + ((short) (bmh [i].wh_extra & 0x0f) << 8));
bm.SetRowSize (bm.Width ());
if ((bTGA = (bm.Flags () & BM_FLAG_TGA)) && (bm.Width () > 256))
bm.SetHeight (bm.Width () * bmh [i].height);
else
bm.SetHeight (bmh [i].height + ((short) (bmh [i].wh_extra & 0xf0) << 4));
bm.SetBPP (bTGA ? 4 : 1);
if (!(bm.Width () * bm.Width ()))
continue;
bm.SetAvgColorIndex (bmh [i].avgColor);
bm.SetType (BM_TYPE_ALT);
if (!bm.CreateBuffer ())
break;
cf.Seek (bmDataOffset + bmOffset, SEEK_SET);
#if DBG
if (indices [i] == nDbgTexture)
nDbgTexture = nDbgTexture;
#endif
if (bTGA) {
int nFrames = bm.Height () / bm.Width ();
tTgaHeader h;
h.width = bm.Width ();
h.height = bm.Width ();
h.bits = 32;
if (!ReadTGAImage (cf, &h, &bm, -1, 1.0, 0, 1)) {
bm.DestroyBuffer ();
break;
}
bm.SetFrameCount ((ubyte) nFrames);
if (nFrames > 1) {
tEffectClip *ecP = NULL;
tWallClip *wcP;
tVideoClip *vcP;
while ((ecP = FindEffect (ecP, indices [i]))) {
//e->vc.nFrameCount = nFrames;
ecP->flags |= EF_ALTFMT | EF_FROMPOG;
}
if (!ecP) {
if ((wcP = FindWallAnim (indices [i]))) {
//w->nFrameCount = nFrames;
wcP->flags |= WCF_ALTFMT | WCF_FROMPOG;
}
else if ((vcP = FindVClip (i))) {
//v->nFrameCount = nFrames;
vcP->flags |= WCF_ALTFMT | WCF_FROMPOG;
}
}
}
j = indices [i];
bm.SetId (j);
}
else {
#if DBG
if (j == nDbgTexture)
nDbgTexture = nDbgTexture;
#endif
ReadBitmap (&bm, int (bm.Width ()) * int (bm.Height ()), &cf, true, false);
j = indices [i];
//.........这里部分代码省略.........