本文整理汇总了C++中engine::GuiButton::BindOnClick方法的典型用法代码示例。如果您正苦于以下问题:C++ GuiButton::BindOnClick方法的具体用法?C++ GuiButton::BindOnClick怎么用?C++ GuiButton::BindOnClick使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类engine::GuiButton
的用法示例。
在下文中一共展示了GuiButton::BindOnClick方法的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 );
}