本文整理汇总了C++中sfg::window::Ptr::SetPosition方法的典型用法代码示例。如果您正苦于以下问题:C++ Ptr::SetPosition方法的具体用法?C++ Ptr::SetPosition怎么用?C++ Ptr::SetPosition使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sfg::window::Ptr
的用法示例。
在下文中一共展示了Ptr::SetPosition方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Run
//.........这里部分代码省略.........
notebook3->SetTabPosition( sfg::Notebook::BOTTOM );
notebook4->SetTabPosition( sfg::Notebook::LEFT );
sfg::Box::Ptr vertigo_box( sfg::Box::Create( sfg::Box::HORIZONTAL ) );
sfg::Button::Ptr vertigo_button( sfg::Button::Create( L"Vertigo" ) );
vertigo_box->Pack( vertigo_button, true, true );
notebook1->AppendPage( boxmain, sfg::Label::Create( "Page Name Here" ) );
notebook1->AppendPage( notebook2, sfg::Label::Create( "Another Page" ) );
notebook2->AppendPage( notebook3, sfg::Label::Create( "Yet Another Page" ) );
notebook2->AppendPage( sfg::Label::Create( L"" ), sfg::Label::Create( "Dummy Page" ) );
notebook3->AppendPage( notebook4, sfg::Label::Create( "And Another Page" ) );
notebook3->AppendPage( sfg::Label::Create( L"" ), sfg::Label::Create( "Dummy Page" ) );
notebook4->AppendPage( vertigo_box, sfg::Label::Create( "And The Last Page" ) );
notebook4->AppendPage( sfg::Label::Create( L"" ), sfg::Label::Create( "Dummy Page" ) );
m_wndmain->Add( notebook1 );
// Signals.
btnaddbuttonh->GetSignal( sfg::Widget::OnLeftClick ).Connect( &SampleApp::OnAddButtonHClick, this );
btnaddbuttonv->GetSignal( sfg::Widget::OnLeftClick ).Connect( &SampleApp::OnAddButtonVClick, this );
m_titlebar_toggle->GetSignal( sfg::Widget::OnLeftClick ).Connect( &SampleApp::OnToggleTitlebarClick, this );
btnhidewindow->GetSignal( sfg::Widget::OnLeftClick ).Connect( &SampleApp::OnHideWindowClicked, this );
btntogglespace->GetSignal( sfg::Widget::OnLeftClick ).Connect( &SampleApp::OnToggleSpaceClick, this );
m_limit_check->GetSignal( sfg::ToggleButton::OnToggle ).Connect( &SampleApp::OnLimitCharsToggle, this );
btnloadstyle->GetSignal( sfg::Widget::OnLeftClick ).Connect( &SampleApp::OnLoadThemeClick, this );
m_scale->GetAdjustment()->GetSignal( sfg::Adjustment::OnChange ).Connect( &SampleApp::OnAdjustmentChange, this );
spinner_toggle->GetSignal( sfg::Widget::OnLeftClick ).Connect( &SampleApp::OnToggleSpinner, this );
mirror_image->GetSignal( sfg::Widget::OnLeftClick ).Connect( &SampleApp::OnMirrorImageClick, this );
spinbutton->SetValue( 20.f );
spinbutton->GetAdjustment()->SetMinorStep( .8f );
m_wndmain->SetPosition( sf::Vector2f( 100.f, 100.f ) );
// Another window
sfg::Window::Ptr second_window( sfg::Window::Create( sfg::Window::TITLEBAR | sfg::Window::BACKGROUND | sfg::Window::RESIZE ) );
second_window->SetId( "second_window" );
second_window->SetTitle( "Resize this window to see ad-hoc wrapping." );
sfg::Box::Ptr box( sfg::Box::Create( sfg::Box::VERTICAL, 5.f ) );
sfg::Label::Ptr lipsum = sfg::Label::Create(
"Nullam ut ante leo. Quisque consequat condimentum pulvinar. "
"Duis a enim sapien, ut vestibulum est. Vestibulum commodo, orci non gravida. "
"Aliquam sed pretium lacus. "
"Nullam placerat mauris vel nulla sagittis pellentesque. "
"Suspendisse in justo dui.\n"
"Ut dolor massa, gravida eu facilisis convallis, convallis sed odio.\n"
"Nunc placerat consequat vehicula."
);
lipsum->SetRequisition( sf::Vector2f( 400.f, 0.f ) );
lipsum->SetLineWrap( true );
box->Pack( lipsum );
second_window->Add( box );
second_window->SetPosition( sf::Vector2f( 10.f, 10.f ) );
second_window->SetId( "second_window" );
m_desktop.Add( second_window );
sfg::Window::Ptr third_window( sfg::Window::Create( sfg::Window::TITLEBAR | sfg::Window::BACKGROUND | sfg::Window::RESIZE ) );
m_gl_canvas = sfg::Canvas::Create( true );
m_gl_canvas->SetRequisition( sf::Vector2f( 200.f, 150.f ) );
third_window->Add( m_gl_canvas );
示例2: Run
//.........这里部分代码省略.........
sfg::Notebook::Ptr notebook4( sfg::Notebook::Create() );
notebook1->SetTabPosition( sfg::Notebook::TOP );
notebook2->SetTabPosition( sfg::Notebook::RIGHT );
notebook3->SetTabPosition( sfg::Notebook::BOTTOM );
notebook4->SetTabPosition( sfg::Notebook::LEFT );
sfg::Box::Ptr vertigo_box( sfg::Box::Create( sfg::Box::HORIZONTAL ) );
sfg::Button::Ptr vertigo_button( sfg::Button::Create( L"Vertigo" ) );
vertigo_box->Pack( vertigo_button, true, true );
notebook1->AppendPage( boxmain, sfg::Label::Create( "Page Name Here" ) );
notebook1->AppendPage( notebook2, sfg::Label::Create( "Another Page" ) );
notebook2->AppendPage( notebook3, sfg::Label::Create( "Yet Another Page" ) );
notebook2->AppendPage( sfg::Label::Create( L"" ), sfg::Label::Create( "Dummy Page" ) );
notebook3->AppendPage( notebook4, sfg::Label::Create( "And Another Page" ) );
notebook3->AppendPage( sfg::Label::Create( L"" ), sfg::Label::Create( "Dummy Page" ) );
notebook4->AppendPage( vertigo_box, sfg::Label::Create( "And The Last Page" ) );
notebook4->AppendPage( sfg::Label::Create( L"" ), sfg::Label::Create( "Dummy Page" ) );
m_wndmain->Add( notebook1 );
// Signals.
btnaddbuttonh->OnClick.Connect( &SampleApp::OnAddButtonHClick, this );
btnaddbuttonv->OnClick.Connect( &SampleApp::OnAddButtonVClick, this );
m_titlebar_toggle->OnClick.Connect( &SampleApp::OnToggleTitlebarClick, this );
btnhidewindow->OnClick.Connect( &SampleApp::OnHideWindowClicked, this );
btntogglespace->OnClick.Connect( &SampleApp::OnToggleSpaceClick, this );
m_limit_check->OnToggle.Connect( &SampleApp::OnLimitCharsToggle, this );
btnloadstyle->OnClick.Connect( &SampleApp::OnLoadThemeClick, this );
m_scale->GetAdjustment()->OnChange.Connect( &SampleApp::OnAdjustmentChange, this );
spinner_toggle->OnClick.Connect( &SampleApp::OnToggleSpinner, this );
m_wndmain->SetPosition( sf::Vector2f( 100.f, 100.f ) );
// Another window
sfg::Window::Ptr second_window( sfg::Window::Create( sfg::Window::TITLEBAR | sfg::Window::BACKGROUND ) );
second_window->SetId( "second_window" );
second_window->SetTitle( "Another window" );
sfg::Box::Ptr box( sfg::Box::Create( sfg::Box::VERTICAL, 5.f ) );
box->Pack( sfg::Label::Create( "Aliquam sed pretium lacus." ), false );
box->Pack( sfg::Label::Create( "Nullam placerat mauris vel nulla sagittis pellentesque." ), false );
box->Pack( sfg::Label::Create( "Suspendisse in justo dui." ), false );
box->Pack( sfg::Label::Create( "Ut dolor massa, gravida eu facilisis convallis, convallis sed odio." ), false );
box->Pack( sfg::Label::Create( "Nunc placerat consequat vehicula." ), false );
second_window->Add( box );
second_window->SetPosition( sf::Vector2f( 10.f, 10.f ) );
second_window->SetId( "second_window" );
m_desktop.Add( second_window );
// Add window to desktop
m_desktop.Add( m_wndmain );
// Play around with resource manager.
sf::Font my_font;
my_font.loadFromFile( "data/linden_hill.otf" );
m_desktop.GetEngine().GetResourceManager().AddFont( "custom_font", my_font, false ); // false -> do not manage!
// Set properties.
m_desktop.SetProperty( "Button#close:Normal", "Color", sf::Color::Yellow );
m_desktop.SetProperty( "Button#close", "FontName", "data/linden_hill.otf" );
m_desktop.SetProperty( "Button#close", "FontSize", 15.f );
m_desktop.SetProperty( "Window#second_window > Box > Label", "FontName", "custom_font" );
m_desktop.SetProperty( "Window#second_window > Box > Label", "FontSize", 18.f );
m_fps_counter = 0;
示例3:
// 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();
}