当前位置: 首页>>代码示例>>C++>>正文


C++ GuiText::SetMaxWidth方法代码示例

本文整理汇总了C++中GuiText::SetMaxWidth方法的典型用法代码示例。如果您正苦于以下问题:C++ GuiText::SetMaxWidth方法的具体用法?C++ GuiText::SetMaxWidth怎么用?C++ GuiText::SetMaxWidth使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在GuiText的用法示例。


在下文中一共展示了GuiText::SetMaxWidth方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: AddButton

void IconEmuMiiBrowser::AddButton()
{
	//!File Icon
	GuiImage * BtnImg = new GuiImage(fileMii);
	BtnImg->SetAlignment(ALIGN_CENTRE, ALIGN_TOP);
	BtnImg->SetPosition(0, 10);
	ButtonImg.push_back(BtnImg);

	//!File Name
	GuiText * BtnTxt = new GuiText((char *) NULL, 14, (GXColor){0, 0, 0, 255});
	BtnTxt->SetAlignment(ALIGN_CENTRE, ALIGN_BOTTOM);
	BtnTxt->SetPosition(0, -20);
	BtnTxt->SetLinesToDraw(2);
	BtnTxt->SetMaxWidth(75, WRAP);
	ButtonText.push_back(BtnTxt);

	//!selection img
	GuiImage * Marker = new GuiImage(bgSelectionEntry);
	Marker->SetAlignment(ALIGN_CENTRE, ALIGN_TOP);
	Marker->SetPosition(0, -7);
	FileSelectionImg.push_back(Marker);

	//!tooltip
	GuiTooltip * tmpToolTip = new GuiTooltip((char *) NULL);
	tmpToolTip->SetPosition(0, 0);
	Tooltip.push_back(tmpToolTip);

	GuiButton * Btn = new GuiButton(90, 90);
	Btn->SetParent(this);
	Btn->SetLabel(BtnTxt);
	Btn->SetIcon(BtnImg);
	Btn->SetImageOver(Marker);
	Btn->SetTrigger(trigA);
	Btn->SetSoundClick(btnSoundClick);
	Btn->SetToolTip(tmpToolTip, 0, 0, ALIGN_CENTRE, ALIGN_TOP);
	Buttons.push_back(Btn);
}
开发者ID:djskual,项目名称:savegame-manager-gx,代码行数:37,代码来源:IconEmuMiiBrowser.cpp

示例2: 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);
	}
开发者ID:Jeremy-D-Miller,项目名称:usbloader-gui,代码行数:101,代码来源:gameinfo.cpp


注:本文中的GuiText::SetMaxWidth方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。