Querying the window resolution (SOLVED)

Started by paolo, Mon 10/09/2007 18:04:32

Previous topic - Next topic

paolo

OK, I'm romping ahead with the game I am working on (my first :)) and making good progress.

I have a GUI on screen that triggers dialogs. I am making the conversation options cause characters to say things. However, because the GUI is modal, it remains on screen while the conversation is running, meaning that the characters' text is sometimes partially obscured by the GUI, which is in the centre of the screen (where I want it to be).

Now, I can't make the GUI go away because it is modal (setting the Visible property to false doesn't work), so I'm looking at using SayAt instead of Say so that I can position the characters' text and control the width, ensuring it doesn't go behind the GUI.

However, this width will depend on the window size - at 640 x 400, there is twice as much space available widthwise, and I'd like to be able to use it rather than using one width for both resolutions, which will look too skinny at the higher resolution.

So my question is - how can you query the window resolution at runtime? Subsidiary question: what does any such function return if the game is being run full-screen?

Alternatively, is there some other way to resolve this issue of text being obscured by the GUI?

Thanks for any help.

GarageGothic

System.ScreenHeight and System.ScreenWidth are the properties that you want. These are returned as the true pixel resolution (e.g. 320, 640 or 800), not as in-engine coordinates (320 and 400 for 640 and 800).

paolo

#2
Thanks very much, that's perfect.

EDIT:
Quote from: GarageGothic on Mon 10/09/2007 18:10:46
System.ScreenHeight and System.ScreenWidth are the properties that you want.

I've just checked in the manual (after getting a compilation error) and it's:

system.screen_width
system.screen_height

(in case anyone else has the same problem).

Ashen

Firstly, please don't double post.

Secondly, it depends on the verson of AGS you're using. System.ScreenWidth/Height (which GarageGothic posted) should be good as of V2.72 (they're in the manual, after all), and the lowercase versions have been obsoleted. In versions 2.71 or earlier, system.screen_width/height are the ones you want.
I know what you're thinking ... Don't think that.

SMF spam blocked by CleanTalk