Remember window positions as preferences

This commit is contained in:
2025-04-09 16:03:31 -05:00
parent c89ea6aa45
commit 3ba9259482
6 changed files with 43 additions and 8 deletions

View File

@@ -184,7 +184,9 @@ void adjust_window_mode() {
mainPtr().create(sf::VideoMode(width, winHeight, 32), "Blades of Exile", sf::Style::Titlebar | sf::Style::Close, winSettings);
// Center the small window on the desktop
mainPtr().setPosition({static_cast<int>((desktop.width - width) / 2), static_cast<int>((desktop.height - height) / 2)});
int win_x = get_int_pref("MainWindowX", static_cast<int>((desktop.width - width) / 2));
int win_y = get_int_pref("MainWindowY", static_cast<int>((desktop.height - height) / 2));
mainPtr().setPosition({win_x, win_y});
} else {
mainPtr().create(desktop, "Blades of Exile", sf::Style::None, winSettings);
mainPtr().setPosition({0,0});