Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

AppGameKit Classic Chat / Non-mobile - Is window position restored or new?

Author
Message
Getafix
7
Years of Service
User Offline
Joined: 14th Apr 2017
Location:
Posted: 31st May 2017 21:45
Hi,

I would like to know if the window positions were restored from a save, or if the app is run for the first time and auto-sized. The reason is that I want to give the user a better 1st time window, but if the user sets their own window size, I don't want to mess with it.

Right now, I use something like if GetDeviceWidth() = 1024 and GetDeviceHeight() = 768 then newRun = 1. if newRun is true then I calculate a window size/position based on the GetMaxDeviceWidth/Height. This works but if the user wanted 1024x768 I would keep changing it (unlikely in my case but alas, not correct

I don't think there is a better way to do this? I thought I could check for the existence of the file window_position.dat but I don't think there's a good way to get the path to the file. GetFileExists("../window_position.dat") won't work and there's no way I can see to get the path to window_position.dat so I can check it with raw access. Does anyone have a though as to how I can either know the window position/size came from a saved file, or know the path to where window_position.dat would live, should it exist?

Thanks
AjiMundi
8
Years of Service
User Offline
Joined: 28th Sep 2015
Location:
Posted: 1st Jun 2017 04:30 Edited at: 1st Jun 2017 04:35
GetMaxDeviceWidth/Height seems to be returning current desktop resolution on Windows. So you can just use that to determine first run size. Then, you can save any user preferences in your own config file and read off that.
If you want to read window_position.dat, then use GetFileExists("/window_position.dat") instead of GetFileExists("../window_position.dat") . That's using '/' instead of '../', in case it's unclear.

Login to post a reply

Server time is: 2024-05-07 04:18:14
Your offset time is: 2024-05-07 04:18:14