# Please save and restore the window position

**URL:** https://community.gemsofwar.com/t/please-save-and-restore-the-window-position/35192
**Category:** Feature Requests and Game feedback
**Created:** [January 22, 2018, 7:42am UTC](https://community.gemsofwar.com/t/please-save-and-restore-the-window-position/35192 "2018-01-22T07:42:07Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![Mad\_Butch](https://sea1.discourse-cdn.com/flex019/user_avatar/community.gemsofwar.com/mad_butch/32/22903_2.png) [@Mad\_Butch](https://community.gemsofwar.com/u/Mad_Butch)
#### Post date: [January 22, 2018, 7:42am UTC](https://community.gemsofwar.com/t/please-save-and-restore-the-window-position/35192/1 "2018-01-22T07:42:07Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![Mad\_Butch](https://sea1.discourse-cdn.com/flex019/user_avatar/community.gemsofwar.com/mad_butch/32/22903_2.png) [@Mad\_Butch](https://community.gemsofwar.com/u/Mad_Butch)
#### Post date: [February 9, 2018, 7:04am UTC](https://community.gemsofwar.com/t/please-save-and-restore-the-window-position/35192/2 "2018-02-09T07:04:31Z")

</div>

And here is actual Unity code that does this.

> **[Is there a way to set the position of a standalone unity window? - Unity Answers](https://answers.unity.com/questions/13523/is-there-a-way-to-set-the-position-of-a-standalone.html)**
>
> Unity is the ultimate game development platform. Use Unity to build high-quality 3D and 2D games, deploy them across mobile, desktop, VR/AR, consoles or the Web, and connect with loyal and enthusiastic players and customers.

@Sirrian @Nimhain

Please?

---

<div class="post-metadata">

### Author: ![Mad\_Butch](https://sea1.discourse-cdn.com/flex019/user_avatar/community.gemsofwar.com/mad_butch/32/22903_2.png) [@Mad\_Butch](https://community.gemsofwar.com/u/Mad_Butch)
#### Post date: [December 29, 2018, 11:56am UTC](https://community.gemsofwar.com/t/please-save-and-restore-the-window-position/35192/3 "2018-12-29T11:56:26Z")

</div>

Almost 2019… and the game still doesn’t remember it’s window position in between sessions.  
Common guys… you are like the last game in the universe that doesn’t do this.

Just think of it this way: Try to imagine how much fun working under windows would be, if no program remembered it’s positions, and you had to move them around every single time you boot them up.

That’s what you’re doing to us…
