find actual resolution

Started by After, Thu 04/12/2003 05:55:08

Previous topic - Next topic

After

[EDIT]
Because this post appears to cause confusion, and
because I'm sure people are assuming the original problem has been solved, and
because the answer would be so simple to anyone who knows it,
I'm putting this first:

If you move your mouse as far down and right as possible, it will give coordinates,
mouse.x=WIDTH-1, mouse.y=HEIGHT-1.

All I'm looking for are the global variables or functions that will return the values of WIDTH and HEIGHT.
Something like,
global.thing_width=WIDTH
or
GetThingWidth()=WIDTH

The following shows what doesn't work
[/EDIT: resume normal thread]

Ok, search fatigue impending, time to ask...

My game (ok, sandbox) is at 320x240, all 'letterbox' options are (compulsorily) checked. Good.

Room 1 is 320x200.
game.room_width/height = 320/200. Good.
system.screen_width/height = 320/200.
Eh? But it displays correctly letterboxed on a 320x240 screen.
Okay, maybe only the live area is reported; I can work with that.

Room 2 is 640x400
game.room_width/height = 640/400. Good.
system.screen_width/height = 320/200.
What? No, no, no. The background now fills the entire 320x240 screen, as it should. This kind of information is no use to me at all.

Now, it has occurred to me that somewhere in AGS' ancestral memory, there lurks a conviction that the sacred combination of 640x400 is really 320x200 in disguise.

I'm at a loss to see how I could have created this situation myself. The options just aren't there for forcing 320x200 into a 320x240 setup.

So, is there a way for me to fix this, either by trying some other import approach or using different globals?
I really don't like the idea that I may have to derive the resolution indirectly.

Gilbert

#1
Actually when you make a game in 640x400, it's screen resolution is 640x400, that means, you can have graphics of that res (provided you import the bg and sprites as hires), so they can look crispier.

BUT: the game resolution used internally is still 320x200 (for speed, memory and compatibility reasons), normally it won't affect much, the only restrictions are for example you can only move/place sprites in 2 screen pixel steps, which IMO is not a big loss unless you need REAL accuracy.

So, just bare in mind that you can use hires graphics, but the coordinate system handled by the engine is still lo-res, so the walkable area, hotspot, etc. (except walkbehind mask which can use hires for artistic reasons) masks ar ein lores, etc.

(Same goes to the other resolutions, for example, a 800x600 game is actually using a 400x300 coordinate system).

EDIT: So I reread your post, Just do this trick:
When you import the bg for room 2, just set the game's resolution temporially to 640x400 and import it, and set it back to 320x200 afterwards and see if that works.

After

#2
Oops, I should've been clearer.
Room 2 is a scrollable room, as intended.
Of this, only a 320x240 viewport on the total room is visible.

Y coordinates 199 to 239 do exist, and are acknowledged by the mouse.

I realize that there are issues about which resolutions are used by different functions, but that's not my immediate problem.

I simply want the program to report the resolution it is actually using for mouse detection and graphical position and rendering.

EDIT: I'm going to fiddle with re-importing anyway.

Gilbert

If it's supposed to be a scrolling room, I think it's normal behaviour that the two black bars would be covered up with backgrounds if the imported bg is higer than 200 (400 for hires, etc) pixels, it was intended to be a "feature" I think. But i know it's frustrating that you'll lose the 2 black bars when you really want then.

I don't know if there are any better solutions at the moment (other than placing 2 black overlay at the borders), I think if the:
Quote
* add option to display images in letterbox borders
part is impremented, it can be fixed easily.

After

#4
I'm sorry that I'm not explaining myself well enough.

Everything looks exactly as I want it to.
The whole 320x240 screen is used. Good.
The room is scrollable. Good.

The only problem is that I can't look up the true dimensions from the script, and therefore cannot make adaptable code, but must (perhaps) enter the resolution manually when required.

I have yet to try rooms smaller than 320x200, but there may be easier alternatives for them.

---------------------------------------------------
Here's my understanding of the options:
Display res: 320x200,640x400 ->Effective res: 320x200
Display res: 320x240,640x480 ->Effective res: 320x240
Display res: 800x600, ->Effective res: 400x300

There may be lower resolutions for things like the pathfinder algorithm too I imagine.

But I can't think of what aspect of a 320x240 res would be at 320x200. So either I'm asking the wrong variable, or its getting it's facts from somewhere I'm not aware of.

I want a variable or function that will return the same dimensions as used by the mouse and overlays.
The viewport dimensions would be ideal.

Isegrim

There are the global vars "system.screen_height" and "system.screen_width". These provide the actual screen resolution;"game.room_height" and "game.room_width"  give the room size in the internal 320x240 coordinate system. Is that what you sought?
If you have question to these, just look up "Global Variables" in the manual.
This post was generated automatically and therefore bears no signature.

Scorpiorus

QuoteMy game (ok, sandbox) is at 320x240...
Room 1 is 320x200.
game.room_width/height = 320/200. Good.
system.screen_width/height = 320/200.
Eh? But it displays correctly letterboxed on a 320x240 screen. Okay, maybe only the live area is reported; I can work with that.
it's fixed in AGS v2.6 where it returns the resolution indeed.


Quote"game.room_height" and "game.room_width" give the room size in the internal 320x240 coordinate system. Is that what you sought?
The trouble is that it returns actual room size not viewport resolution. So in a 320x270 scrolling room the game.room_height would hold 270.

Quote
[EDIT]
Because this post appears to cause confusion, and
because I'm sure people are assuming the original problem has been solved, and
because the answer would be so simple to anyone who knows it,
I'm putting this first:

If you move your mouse as far down and right as possible, it will give coordinates,
mouse.x=WIDTH-1, mouse.y=HEIGHT-1.

All I'm looking for are the global variables or functions that will return the values of WIDTH and HEIGHT.
Something like,
global.thing_width=WIDTH
or
GetThingWidth()=WIDTH

The following shows what doesn't work
[/EDIT: resume normal thread]
Well, you could define these in your global script once and for all. The room resoultion isn't changed until you choose another one from the main menu.

Though I agree something like GetViewportWidth/Height() would be handy.

The 1st thing has come to my mind is to trick it with the function like that:

function GetViewportHeight() {
int mx = mouse.x;
int my = mouse.y;
SetMousePosition(game.room_width, game.room_height);
int result = mouse.y+1;
SetMousePosition(mx, my);
return result;
}

I though it truncate it down to viewport... and it does but seems like there is a bug where the SetMousePosition() sets a position only within 320x200 bound even if you run at 320x240 with no letterbox.

~Cheers

After

#7
Well, at least now I know, and can just go ahead and #define them without feeling so bad  8)

Thanks for trying that trick.
I'm trying to resist overcoding the small stuff at this point, so I'll just put the values in the header instead.

I was only resisting because defining them myself would have been stupid if they were already built in.

[edit] Maybe I should read the updates more often.

SMF spam blocked by CleanTalk