center gui window by manually setting its position

This commit is contained in:
Josh Holtrop 2012-11-03 09:03:23 -04:00
parent 6a6184ab59
commit ad3e8a5481

View File

@ -106,6 +106,9 @@ void Client::run_main_menu()
sfg::Window::BACKGROUND));
window->SetTitle("SFGUI window");
window->Add(label);
window->SetPosition(sf::Vector2f(
m_width / 2 - window->GetAllocation().width / 2,
m_height / 2 - window->GetAllocation().height / 2));
sfg::Desktop desktop;
desktop.Add(window);
m_window->resetGLStates();