Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: Ronsen on Tue 03/02/2015 11:43:20

Title: Native desktop resolution & Scaling?
Post by: Ronsen on Tue 03/02/2015 11:43:20
Hi there,

on my attempt to build some of the winsetup functions ingame I run into some questions/trouble ;)
Is there a way to get the native desktop resolution and supported resolution modes? I had a look at:

System.ViewportWidth/Height and System.ScreenWidth/Height both gave me my game resolution which i set under "General Settings -> Resolution" (in my case 320x200).

Which is good to write
Code (ags) Select

[misc]
game_width=320
game_height=200

but I need also
Code (ags) Select

[graphics]
screen_width=1280
screen_height=1024


...is there something?

Second question to understand the scaling..

My first PC has native desktop res. of 1280x1024 so the max filter scaling is recognised as x4 ( 1280x1024 / 320x200 = 4) is that right?
My second PC has a native desktop res. of 3840x2160 / 320x200 so max filter is x10 ....
So if I divide desktop.height/game.height and desktop.width/game.width each and take the lowest value as my max scale....that should work as well for custom game resolution right? Or is there a awesome crazy formular for the scaling?

I'm using the alpha AGS 3.4.0.3 ....
Title: Re: Native desktop resolution & Scaling?
Post by: Crimson Wizard on Tue 03/02/2015 11:46:29
No, currently AGS script provides no means to know available resolutions of your display.

System.ScreenWidth/Height is not what you would think they are; as manual states their values are rather ... peculiar:
Quote
Returns the actual screen width that the game is running at. If a graphic filter is in use, the resolution returned will be that before any stretching by the filter has been applied. If widescreen side borders are enabled, the screen width reported will include the size of these borders
This is because how AGS worked before 3.4.0 - the black borders were part of game drawing routine. Now they are not.
Since 3.4.0 System.ScreenWidth/Height will return same values as ViewportWidth/Height, except the case when the game is designed with "letterbox" mode option in General Settings.
This was left for backwards compatibility (some games use them for calculating coordinates, although game developers should not normally do that).
This may change sometime in future, but now it is like this.

Quote from: Ronsen on Tue 03/02/2015 11:43:20
So if I divide desktop.height/game.height and desktop.width/game.width each and take the lowest value as my max scale....that should work as well for custom game resolution right?
Yes, it is that simple.