Is there a way to perfectly center a windowed app to the user's resolution?

I can't seem to find any way to find the center of the screen width and height through the config.
I'd imagine it looks something like this, where "Center?" is the correct way to get the width/2 and height/2 of the screen's reported resolution.

[Display]
ScreenPosition = (Center?, Center?)

If it can't be done through the config, then how would it be done through my source file, in c++?

Tagged:

Comments

  • Hi GaryM, welcome to the forum. I was going to direct you to the display config section on the wiki but it's currently down. Dreadful timing. You can find all the settings here: https://github.com/orx/orx/blob/master/code/bin/SettingsTemplate.ini

    Or in the SettingTemplate.ini in your repo.

    I think you are right that your game will display in the top left if using full window borderless mode.

    Change your settings to use proper full screen mode first to get your going. I'll be interested to solve your issue and I'll put an example in the wiki once it's back up.

  • The wiki is back up :)

    The thing is that fullscreen and borderless fullscreen work fine, but let's say the resolution of my game is something like 1280 x 720, just for example. You would have the windowed mode, but you could maximize it to fullscreen as well. In windowed mode, it just spawns the window at the very top left unless you use magic numbers to position it.

    I tried looking through the api documentation and examples, and searching forum posts, but I wasn't able to find the specific thing I'm looking for.

    Thanks!

Sign In or Register to comment.