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


C++ GuiButton::SetFont方法代码示例

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


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

示例1: Initialize

void FileSelectionDialogState::Initialize() {
	Engine::Logger::Urgent(Engine::LogOrigin::STATE, "Initializing FileSelectionDialogState.");

	mBackgroundShape = sf::Shape::Rectangle(0,0,800,600,sf::Color(0,0,0,128));

	CreateGuiSystem();

	// Load Resources
	auto resmgr = Engine::Root::get_mutable_instance().GetResourceManagerPtr();

	// GUI
	resmgr->AddImage(boost::filesystem::path("../game/gui"),
			"button.svg", 0.48f, 0.48f, "gui.button");
	resmgr->AddImage(boost::filesystem::path("../game/gui"),
			"button_hover.svg",	0.48f,	0.48f,	"gui.button_hover");
	resmgr->AddImage(boost::filesystem::path("../game/gui"),
			"button_focus.svg", 0.48f, 0.48f,	"gui.button_focus");
	resmgr->AddImage(boost::filesystem::path("../game/gui"),
			"textfield2.svg", 0.24f, 0.24f, "gui.textfield");


	// Gui grid for buttons
	Engine::GuiGrid* grid = new Engine::GuiGrid("debug_grid");
	grid->SetDimension(Engine::Vector2D(160, 100));
	Engine::Vector2D size(Engine::Root::get_mutable_instance().GetWindowSize());
	size -= grid->GetDimension();
	size /= 2;
	grid->SetPosition(size.x, size.y);

	// Resume button
	Engine::GuiButton* b;

	Engine::GuiTextfield* t;

	t = new Engine::GuiTextfield("filename_input");
	grid->AddControl(t);

	Engine::GuiGrid* btn_grid = new Engine::GuiGrid("btn_grid");
	btn_grid->SetDimension(Engine::Vector2D(160, 25));
	btn_grid->SetColumns(2);

	b = new Engine::GuiButton("resume_button");
	b->SetText("Ok");
	b->SetFont(sf::Font::GetDefaultFont());
	b->SetFontSize(13);
	b->SetFontStyle(sf::Text::Regular);
	b->SetFontColor(sf::Color::White);
	b->BindOnClick(boost::bind(&FileSelectionDialogState::OkButton_OnClick, this, _1));
	btn_grid->AddControl(b);

	b = new Engine::GuiButton("exit_button");
	b->SetText("Cancel");
	b->SetFont(sf::Font::GetDefaultFont());
	b->SetFontSize(13);
	b->SetFontStyle(sf::Text::Regular);
	b->SetFontColor(sf::Color::White);
	b->BindOnClick(boost::bind(&FileSelectionDialogState::ExitButton_OnClick, this, _1));
	btn_grid->AddControl(b);

	grid->AddControl(btn_grid);

	mGuiSystems.begin()->AddControl(grid);

	auto inputmgr = Engine::Root::get_mutable_instance().GetInputManagerPtr();
	// Bind Keys
	Engine::KeyBindingCallback cb = boost::bind(&FileSelectionDialogState::OnPressEscape, this);
	inputmgr->BindKey( cb, Engine::KEY_PRESSED, sf::Key::Escape );
}
开发者ID:svenstaro,项目名称:NoisyHunter,代码行数:68,代码来源:FileSelectionDialogState.cpp


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