本文整理汇总了C++中GuiText::GetTextWidth方法的典型用法代码示例。如果您正苦于以下问题:C++ GuiText::GetTextWidth方法的具体用法?C++ GuiText::GetTextWidth怎么用?C++ GuiText::GetTextWidth使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GuiText
的用法示例。
在下文中一共展示了GuiText::GetTextWidth方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: InternalShowGameInfo
//.........这里部分代码省略.........
else if (GameInfo.RatingType == 0)
{
if (strcmp(GameInfo.RatingValue.c_str(), "A") == 0)
ratingImgData = Resources::GetImageData("cero_a.png");
else if (strcmp(GameInfo.RatingValue.c_str(), "B") == 0)
ratingImgData = Resources::GetImageData("cero_b.png");
else if (strcmp(GameInfo.RatingValue.c_str(), "C") == 0)
ratingImgData = Resources::GetImageData("cero_c.png");
else if (strcmp(GameInfo.RatingValue.c_str(), "D") == 0)
ratingImgData = Resources::GetImageData("cero_d.png");
else if (strcmp(GameInfo.RatingValue.c_str(), "Z") == 0)
ratingImgData = Resources::GetImageData("cero_z.png");
else
{
ratingImgData = Resources::GetImageData("norating.png");
}
}
else
{
ratingImgData = Resources::GetImageData("norating.png");
}
ratingImg = new GuiImage(ratingImgData);
ratingImg->SetWidescreen(Settings.widescreen);
ratingImg->SetPosition(-25, inputY);
ratingImg->SetAlignment(1, 4);
InfoWindow.Append(ratingImg);
intputX += (Settings.widescreen ? ratingImg->GetWidth() * Settings.WSFactor : ratingImg->GetWidth()) + 5;
}
// title
int titlefontsize = 25;
if (GameInfo.Title.size() > 0)
{
titleTxt = new GuiText(GameInfo.Title.c_str(), titlefontsize, ( GXColor ) {0, 0, 0, 255});
titleTxt->SetMaxWidth(350, SCROLL_HORIZONTAL);
titleTxt->SetAlignment(ALIGN_CENTER, ALIGN_TOP);
titleTxt->SetPosition(txtXOffset, 12 + titley);
InfoWindow.Append(titleTxt);
}
//date
snprintf(linebuf2, sizeof(linebuf2), " ");
if (GameInfo.PublishDate != 0)
{
int year = GameInfo.PublishDate >> 16;
int day = GameInfo.PublishDate & 0xFF;
int month = (GameInfo.PublishDate >> 8) & 0xFF;
snprintf(linebuf2, sizeof(linebuf2), "%02i ", day);
switch (month)
{
case 1:
snprintf(linebuf2, sizeof(linebuf2), "%s%s ", linebuf2, tr( "Jan" ));
break;
case 2:
snprintf(linebuf2, sizeof(linebuf2), "%s%s ", linebuf2, tr( "Feb" ));
break;
case 3:
snprintf(linebuf2, sizeof(linebuf2), "%s%s ", linebuf2, tr( "Mar" ));
break;
case 4:
snprintf(linebuf2, sizeof(linebuf2), "%s%s ", linebuf2, tr( "Apr" ));
break;
case 5:
snprintf(linebuf2, sizeof(linebuf2), "%s%s ", linebuf2, tr( "May" ));
break;
case 6:
snprintf(linebuf2, sizeof(linebuf2), "%s%s ", linebuf2, tr( "June" ));
break;
case 7:
snprintf(linebuf2, sizeof(linebuf2), "%s%s ", linebuf2, tr( "July" ));
break;
case 8:
snprintf(linebuf2, sizeof(linebuf2), "%s%s ", linebuf2, tr( "Aug" ));
break;
case 9:
snprintf(linebuf2, sizeof(linebuf2), "%s%s ", linebuf2, tr( "Sept" ));
break;
case 10:
snprintf(linebuf2, sizeof(linebuf2), "%s%s ", linebuf2, tr( "Oct" ));
break;
case 11:
snprintf(linebuf2, sizeof(linebuf2), "%s%s ", linebuf2, tr( "Nov" ));
break;
case 12:
snprintf(linebuf2, sizeof(linebuf2), "%s%s ", linebuf2, tr( "Dec" ));
break;
}
char linebuf[300];
snprintf(linebuf, sizeof(linebuf), "%s : %s%i", tr( "Released" ), linebuf2, year);
releasedTxt = new GuiText(linebuf, 16, ( GXColor ) {0, 0, 0, 255});
if (releasedTxt->GetTextWidth() > 300) newline = 2;
releasedTxt->SetAlignment(ALIGN_RIGHT, ALIGN_TOP);
releasedTxt->SetPosition(-17, 12 + indexy);
indexy += (20 * newline);
newline = 1;
InfoWindow.Append(releasedTxt);
}
示例2: AddOption
void GuiArrowOption::AddOption(const char * name, int PositionX, int PositionY)
{
int Center = PositionX;
GuiText * OptName = new GuiText(name, 16, (GXColor) {
0, 0, 0, 255
});
OptName->SetAlignment(ALIGN_LEFT | ALIGN_TOP);
OptName->SetPosition(Center-OptName->GetTextWidth()/2, PositionY);
GuiText * OptText = new GuiText(" ", 16, (GXColor) {
0, 0, 0, 255
});
OptText->SetPosition(Center-OptText->GetTextWidth()/2, PositionY+30);
OptText->SetAlignment(ALIGN_LEFT | ALIGN_TOP);
GuiButton * OptBtn = new GuiButton(OptName->GetTextWidth(), 18);
OptBtn->SetSoundOver(btnSoundOver);
OptBtn->SetSoundClick(btnClick);
OptBtn->SetTrigger(trigA);
OptBtn->SetPosition(Center-OptText->GetTextWidth()/2, PositionY+30);
OptBtn->SetAlignment(ALIGN_LEFT | ALIGN_TOP);
OptBtn->Clicked.connect(this, &GuiArrowOption::OnButtonClick);
GuiImage * OptImgLeft = new GuiImage(ArrowImgData);
OptImgLeft->SetAngle(180);
GuiButton * OptBtnLeft = new GuiButton(OptImgLeft->GetWidth(), OptImgLeft->GetHeight());
OptBtnLeft->SetImage(OptImgLeft);
OptBtnLeft->SetSoundOver(btnSoundOver);
OptBtnLeft->SetSoundClick(btnClick);
OptBtnLeft->SetTrigger(trigA);
OptBtnLeft->SetEffectGrow();
OptBtnLeft->SetPosition(Center-(OptText->GetTextWidth()/2+10), PositionY+30);
OptBtnLeft->SetAlignment(ALIGN_LEFT | ALIGN_TOP);
OptBtnLeft->Clicked.connect(this, &GuiArrowOption::OnLeftButtonClick);
GuiImage * OptImgRight = new GuiImage(ArrowImgData);
GuiButton * OptBtnRight = new GuiButton(OptImgRight->GetWidth(), OptImgRight->GetHeight());
OptBtnRight->SetImage(OptImgRight);
OptBtnRight->SetSoundOver(btnSoundOver);
OptBtnRight->SetSoundClick(btnClick);
OptBtnRight->SetTrigger(trigA);
OptBtnRight->SetEffectGrow();
OptBtnRight->SetPosition(Center+(OptText->GetTextWidth()/2+10), PositionY+30);
OptBtnRight->SetAlignment(ALIGN_LEFT | ALIGN_TOP);
OptBtnRight->Clicked.connect(this, &GuiArrowOption::OnRightButtonClick);
Append(OptName);
Append(OptText);
Append(OptBtn);
Append(OptBtnLeft);
Append(OptBtnRight);
OptionsName.push_back(OptName);
OptionsText.push_back(OptText);
OptionsBtn.push_back(OptBtn);
OptionsImgLeft.push_back(OptImgLeft);
OptionsBtnLeft.push_back(OptBtnLeft);
OptionsImgRight.push_back(OptImgRight);
OptionsBtnRight.push_back(OptBtnRight);
}