本文整理汇总了C++中sfg::window::Ptr::SetRequisition方法的典型用法代码示例。如果您正苦于以下问题:C++ Ptr::SetRequisition方法的具体用法?C++ Ptr::SetRequisition怎么用?C++ Ptr::SetRequisition使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sfg::window::Ptr
的用法示例。
在下文中一共展示了Ptr::SetRequisition方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
// Constructor
InterfaceWorldEditor(Scene* s) :Interface()
{
tools.push_back({"Select","Resources\\gfx\\worldeditor\\tool_select.png"});
tools.push_back({ "Rotate", "Resources\\gfx\\worldeditor\\tool_rotate.png" });
tools.push_back({ "Scale", "Resources\\gfx\\worldeditor\\tool_scale.png" });
tools.push_back({ "Camera", "Resources\\gfx\\worldeditor\\tool_camera.png" });
// Import scene pointer
scene = reinterpret_cast<SceneEditor*>(s);
// Setup windows
float propHeight = (scene->getGUIHeight() / 5) * 4;
windowProperties = sfg::Window::Create(sfg::Window::Style::TITLEBAR | sfg::Window::Style::BACKGROUND);
windowProperties->SetTitle("Properties");
windowProperties->SetPosition(sf::Vector2f(10.0f,10.0f));
windowProperties->SetRequisition(sf::Vector2f(300.0f,propHeight));
windowObjectBrowser = sfg::Window::Create(sfg::Window::Style::TITLEBAR | sfg::Window::Style::BACKGROUND);
windowObjectBrowser->SetTitle("Object Browser");
windowObjectBrowser->SetPosition(sf::Vector2f(10.0f, propHeight + 10.0f + 5.0f));
windowObjectBrowser->SetRequisition(sf::Vector2f(scene->getGUIWidth() - 20.0f, scene->getGUIHeight() - propHeight - 20.0f - 10.0f));
windowLayer = sfg::Window::Create(sfg::Window::Style::TITLEBAR | sfg::Window::Style::BACKGROUND);
windowLayer->SetTitle("Layers");
windowLayer->SetPosition(sf::Vector2f(350.0f,propHeight-90.0f));
windowLayer->SetRequisition(sf::Vector2f(400.0f,50.0f));
// Populate layer window
boxLayer = sfg::Box::Create(sfg::Box::Orientation::HORIZONTAL, 5.0f);
buttonLayerBackground = sfg::ToggleButton::Create();
//buttonLayerBackground->SetLabel("Background");
buttonLayerBackground->GetSignal(sfg::ToggleButton::OnLeftClick).Connect(std::bind(&InterfaceWorldEditor::onButtonLayerBackground, this));
buttonLayerTerrain = sfg::ToggleButton::Create();
//buttonLayerTerrain->SetLabel("Terrain");
buttonLayerTerrain->GetSignal(sfg::ToggleButton::OnLeftClick).Connect(std::bind(&InterfaceWorldEditor::onButtonLayerTerrain, this));
buttonLayerObject = sfg::ToggleButton::Create();
//buttonLayerObject->SetLabel("Object");
buttonLayerObject->GetSignal(sfg::ToggleButton::OnLeftClick).Connect(std::bind(&InterfaceWorldEditor::onButtonLayerObject, this));
buttonLayerForeground = sfg::ToggleButton::Create();
//buttonLayerForeground->SetLabel("Foreground");
buttonLayerForeground->GetSignal(sfg::ToggleButton::OnLeftClick).Connect(std::bind(&InterfaceWorldEditor::onButtonLayerForeground, this));
buttonLayerAudio = sfg::ToggleButton::Create();
//buttonLayerAudio->SetLabel("Audio");
buttonLayerAudio->GetSignal(sfg::ToggleButton::OnLeftClick).Connect(std::bind(&InterfaceWorldEditor::onButtonLayerAudio, this));
buttonLayerAll = sfg::ToggleButton::Create();
//buttonLayerAll->SetLabel("All");
buttonLayerAll->SetActive(true);
buttonLayerAll->GetSignal(sfg::ToggleButton::OnLeftClick).Connect(std::bind(&InterfaceWorldEditor::onButtonLayerAll,this));
loadImageFor(buttonLayerBackground, "Resources\\gfx\\worldeditor\\layer_background.png");
loadImageFor(buttonLayerTerrain, "Resources\\gfx\\worldeditor\\layer_terrain.png");
loadImageFor(buttonLayerObject, "Resources\\gfx\\worldeditor\\layer_object.png");
loadImageFor(buttonLayerForeground, "Resources\\gfx\\worldeditor\\layer_foreground.png");
loadImageFor(buttonLayerAudio, "Resources\\gfx\\worldeditor\\layer_sound.png");
loadImageFor(buttonLayerAll, "Resources\\gfx\\worldeditor\\layer_all.png");
boxLayer->Pack(buttonLayerBackground);
boxLayer->Pack(buttonLayerTerrain);
boxLayer->Pack(buttonLayerObject);
boxLayer->Pack(buttonLayerForeground);
boxLayer->Pack(buttonLayerAudio);
boxLayer->Pack(buttonLayerAll);
windowLayer->Add(boxLayer);
windowTool = sfg::Window::Create(sfg::Window::Style::TITLEBAR | sfg::Window::Style::BACKGROUND);
windowTool->SetTitle("Tools");
windowTool->SetPosition(sf::Vector2f(scene->getGUIWidth()-100.0f,10.0f));
windowTool->SetRequisition(sf::Vector2f(80.0f,propHeight));
refreshPropertiesWindow();
refreshToolsWindow();
}