From 3ba6266cd4dc02108b6ebfc16712a8c6a062ec1a Mon Sep 17 00:00:00 2001 From: Celtic Minstrel Date: Sun, 23 Feb 2020 23:29:44 -0500 Subject: [PATCH] Fix editors launching in the top left corner of the screen --- src/pcedit/pc.main.cpp | 3 ++- src/scenedit/scen.main.cpp | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/pcedit/pc.main.cpp b/src/pcedit/pc.main.cpp index 9f905016..31c387b0 100644 --- a/src/pcedit/pc.main.cpp +++ b/src/pcedit/pc.main.cpp @@ -143,7 +143,8 @@ void init_main_window (sf::RenderWindow& mainPtr, sf::View& mainView) { ; mainPtr.create(sf::VideoMode(width, height), "Blades of Exile Character Editor", sf::Style::Titlebar | sf::Style::Close); - mainPtr.setPosition({0,0}); + sf::VideoMode desktop = sf::VideoMode::getDesktopMode(); + mainPtr.setPosition({static_cast((desktop.width - width) / 2), static_cast((desktop.height - height) / 2)}); // Initialize the view mainView.setSize(width, height); diff --git a/src/scenedit/scen.main.cpp b/src/scenedit/scen.main.cpp index da42555c..87119b39 100644 --- a/src/scenedit/scen.main.cpp +++ b/src/scenedit/scen.main.cpp @@ -163,7 +163,8 @@ void init_main_window (sf::RenderWindow & mainPtr, sf::View & mainView) { ; mainPtr.create(sf::VideoMode(width, height), "Blades of Exile Scenario Editor", sf::Style::Titlebar | sf::Style::Close); - mainPtr.setPosition({0,0}); + sf::VideoMode desktop = sf::VideoMode::getDesktopMode(); + mainPtr.setPosition({static_cast((desktop.width - width) / 2), static_cast((desktop.height - height) / 2)}); // Initialize the view mainView.setSize(width, height);