本文整理汇总了C++中Font::GetCharHeight方法的典型用法代码示例。如果您正苦于以下问题:C++ Font::GetCharHeight方法的具体用法?C++ Font::GetCharHeight怎么用?C++ Font::GetCharHeight使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Font
的用法示例。
在下文中一共展示了Font::GetCharHeight方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Draw
void TypewriterText::Draw(CDisplay& DisplayRef)
{
for(int i = 0, k = 0; k < mFirstLine && i < mStringLength; i++)
{
if(mString[i] == '\n')
k++;
}
if(i >= mStringLength){
return; //UH, WHAT?
}
Font* OurFont = GetFontBySizeIndex(mFontNumber);
if(!OurFont)
return;
//WE'RE AT OUR STARTING POINT.
POINT Origin;
Origin.x = mXOrigin;
Origin.y = mYOrigin;
int DrawnLines = 1;
for(; i < mCurrentStringPosition && DrawnLines <= mMaxLinesToDraw; i++)
{
if(mString[i] == '\n'){
Origin.y += OurFont->GetCharHeight();
DrawnLines++;
Origin.x = mXOrigin;
}
else{
Origin.x += OurFont->DrawLetter(mString[i], Origin);
}
}
//WE'RE AT THE CURSOR POSITION.
if(mCursorSpriteNumber == -1 || mCursorFlashDelay == -1){
return;
}
if(Origin.x + mCursorSprite.GetWidth() > mWidth + mXOrigin){
Origin.y += OurFont->GetCharHeight();
}
mCursorSprite.SetLoc(Origin);
if(mCursorOn)
mCursorSprite.Draw(DisplayRef);
}
示例2: Init
void BriefingBox::Init()
{
mBoxSprite.InitializeSpriteCopy(GetGlobalSpriteData(BRIEFINGBOX_SPRITE_NUMBER));
mBoxSprite.SetDelay(800);
RECT Client;
GetClientRect(TheDisplay.GetHWnd(), &Client);
mCenterToStop = ((Client.right - Client.left) / 2) - (mBoxSprite.GetWidth() / 2);
int MaxLines = 10;
Font* TheFont = GetFontBySizeIndex(BRIEFINGBOX_TEXT_FONTNUMBER);
if(TheFont){
int Height = (mBoxSprite.GetHeight() - BRIEFINGBOX_TEXT_BOTTOM) - BRIEFINGBOX_TEXT_YOFFSET;
MaxLines = Height / TheFont->GetCharHeight();
}
mCenterToClose = mBoxSprite.GetWidth() * -1;
mOrigin.y = ((Client.bottom - Client.top) / 2) - (mBoxSprite.GetHeight() / 2);
mOrigin.x = mCenterToClose;
mCurrentText.Initialize("TESTING!", mOrigin, 20, mBoxSprite.GetWidth() - (3 * BRIEFINGBOX_TEXT_XOFFSET), BRIEFINGBOX_TEXT_FONTNUMBER,
BRIEFINGBOX_CURSOR_SPRITE_NUMBER, 80, -1, BRIEFINGBOX_CURSOR_SOUND_NUMBER, BRIEFINGBOX_CURSOR_ENDLINESOUND_NUMBER, MaxLines);
}