本文整理汇总了C++中FTexture::GetScaledTopOffset方法的典型用法代码示例。如果您正苦于以下问题:C++ FTexture::GetScaledTopOffset方法的具体用法?C++ FTexture::GetScaledTopOffset怎么用?C++ FTexture::GetScaledTopOffset使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FTexture
的用法示例。
在下文中一共展示了FTexture::GetScaledTopOffset方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: AddHiresTextures
void FTextureManager::AddHiresTextures (int wadnum)
{
int firsttx = Wads.GetFirstLump(wadnum);
int lasttx = Wads.GetLastLump(wadnum);
char name[9];
TArray<FTextureID> tlist;
if (firsttx == -1 || lasttx == -1)
{
return;
}
name[8] = 0;
for (;firsttx <= lasttx; ++firsttx)
{
if (Wads.GetLumpNamespace(firsttx) == ns_hires)
{
Wads.GetLumpName (name, firsttx);
if (Wads.CheckNumForName (name, ns_hires) == firsttx)
{
tlist.Clear();
int amount = ListTextures(name, tlist);
if (amount == 0)
{
// A texture with this name does not yet exist
FTexture * newtex = FTexture::CreateTexture (firsttx, FTexture::TEX_Any);
if (newtex != NULL)
{
newtex->UseType=FTexture::TEX_Override;
AddTexture(newtex);
}
}
else
{
for(unsigned int i = 0; i < tlist.Size(); i++)
{
FTexture * newtex = FTexture::CreateTexture (firsttx, FTexture::TEX_Any);
if (newtex != NULL)
{
FTexture * oldtex = Textures[tlist[i].GetIndex()].Texture;
// Replace the entire texture and adjust the scaling and offset factors.
newtex->bWorldPanning = true;
newtex->SetScaledSize(oldtex->GetScaledWidth(), oldtex->GetScaledHeight());
newtex->LeftOffset = FixedMul(oldtex->GetScaledLeftOffset(), newtex->xScale);
newtex->TopOffset = FixedMul(oldtex->GetScaledTopOffset(), newtex->yScale);
ReplaceTexture(tlist[i], newtex, true);
}
}
}
//StartScreen->Progress();
}
}
}
}
示例2: strncmp
FFont::FFont (const char *name, const char *nametemplate, int first, int count, int start)
{
int i, lump;
char buffer[12];
int *charlumps;
BYTE usedcolors[256], identity[256];
double *luminosity;
int maxyoffs;
bool doomtemplate = gameinfo.gametype == GAME_Doom ? strncmp (nametemplate, "STCFN", 5) == 0 : false;
Chars = new CharData[count];
charlumps = new int[count];
PatchRemap = new BYTE[256];
Ranges = NULL;
FirstChar = first;
LastChar = first + count - 1;
FontHeight = 0;
GlobalKerning = false;
memset (usedcolors, 0, 256);
Name = copystring (name);
Next = FirstFont;
FirstFont = this;
maxyoffs = 0;
for (i = 0; i < count; i++)
{
sprintf (buffer, nametemplate, i + start);
lump = Wads.CheckNumForName (buffer, ns_graphics);
if (doomtemplate && lump >= 0 && i + start == 121)
{ // HACKHACK: Don't load STCFN121 in doom(2), because
// it's not really a lower-case 'y' but an upper-case 'I'.
// Because a lot of wads with their own font seem to foolishly
// copy STCFN121 and make it an 'I' themselves, wads must
// provide STCFN120 (x) and STCFN122 (z) for STCFN121 to load.
if (Wads.CheckNumForName ("STCFN120", ns_graphics) == -1 ||
Wads.CheckNumForName ("STCFN122", ns_graphics) == -1)
{
lump = -1;
}
}
charlumps[i] = lump;
if (lump >= 0)
{
FTexture *pic = TexMan[TexMan.AddPatch (buffer)];
int height = pic->GetScaledHeight();
int yoffs = pic->GetScaledTopOffset();
if (yoffs > maxyoffs)
{
maxyoffs = yoffs;
}
height += abs (yoffs);
if (height > FontHeight)
{
FontHeight = height;
}
RecordTextureColors (pic, usedcolors);
}
}
ActiveColors = SimpleTranslation (usedcolors, PatchRemap, identity, &luminosity);
for (i = 0; i < count; i++)
{
if (charlumps[i] >= 0)
{
Chars[i].Pic = new FFontChar1 (charlumps[i], PatchRemap);
}
else
{
Chars[i].Pic = NULL;
}
}
if ('N'-first>=0 && 'N'-first<count && Chars['N' - first].Pic)
{
SpaceWidth = (Chars['N' - first].Pic->GetScaledWidth() + 1) / 2;
}
else
{
SpaceWidth = 4;
}
BuildTranslations (luminosity, identity, &TranslationParms[0][0]);
delete[] luminosity;
delete[] charlumps;
}