Please save and restore the window position


#1

If you play in windowed mode, you should NOT have to move the window to where you want it every single time you run the game.

Just save and restore the window position in between sessions.

Here is the code:
Upon closing the game:

// Retrieve the X,Y origin of the window
WINDOWPLACEMENT	windowPlacement;
memset( &windowPlacement, 0, sizeof(windowPlacement) );
windowPlacement.length = sizeof(WINDOWPLACEMENT);
GetWindowPlacement( hwnd, &windowPlacement );

// Store the current X,Y origin
x = windowPlacement.rcNormalPosition.left;
y = windowPlacement.rcNormalPosition.top;

Then all you have to do it store that x and y, and use them when you create the game window when the game is started (aka same place where you use the stored width and height).

And I’m sure it’s even easier in unity, as saving and restoring the window position is pretty much common behaviour in all games.


#2

And here is actual Unity code that does this.
https://answers.unity.com/questions/13523/is-there-a-way-to-set-the-position-of-a-standalone.html

@Sirrian @Nimhain

Please?