How to return the RELATIVE screen dimensions? (Solved)

Started by strazer, Sat 24/04/2004 18:28:52

Previous topic - Next topic

strazer

Is there a way to return the relative (320x200-scale) width and height of the screen?

I have a function that includes continously setting the viewport around a point that is moving about the room:
SetViewport(x3-160, y3-120);

I'd like to replace the 160 (320/2) and 120 (240/2) as to make the function resolution-independent, so it can easily be pasted into any project.
The game.room_height and game.room_width variables return the wrong values in scrolling rooms.

EDIT: Added in AGS v2.61 RC 1: New variables system.viewport_width and system.viewport_height. Thank you!

Pumaman

The best way to do it would be:

if (system.screen_height == 200)
  relative size = 320x200
else if (system.screen_height == 240)
  relative size = 320x240
else if (system.screen_height == 400)
  relative size = 320x200
else if (system.screen_height == 480)
  relative size = 320x240
else if (system.screen_height == 600)
  relative size = 400x300

Rather messy I agree, I'll see about adding some new system. variables to return what you want.

strazer

Ok, thought so. Thanks.
Yes, game.viewport_width or something would be nice.

Scorpiorus

Yeah, something returning viewport width/height would be really handy, as there is also a letterbox mode that should be checked to get the right height.

SMF spam blocked by CleanTalk