Jump to content
  • Advertisement
Sign in to follow this  
amirabiri

Monitor physical dimensions

This topic is 3353 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi, I've got a bit of an odd question: is there a way to tell the monitor's "physical" dimensions or aspect ratio? The reason I'm asking is that in my game engine I've got a conversion system so that all my game logic is based on game size and distance units. Those units are translated to pixels when rendering, but all game logic is agnostic of this conversion. The conversion itself is based on the current resolution of course, so you'd always see the game with the same relative sizes regardless of the resolution. It works quite well as long as you use the same monitor resolution, i.e 3:4, 9:16, 1:1, etc. But the problem is that the same monitor can be used with different aspect ratios, and I was wondering if there is a way to overcome that? I imagine that in order to do so I would have to consider the resolution ratio as an unreliable source, and acquire the physical ratio to base my conversion on. ?

Share this post


Link to post
Share on other sites
Advertisement
In general, I would say this is more trouble than it's worth. Simply let the user choose a display resolution (or use the resolution their desktop is set to) and assume they've chosen the correct resolution for their monitor.

However, you can do it. On Vista or later, you can use WMI to read the EDID information (reference, in particular, I believe the information returned in WmiMonitorBasicDisplayParams is what you want). On XP and prior, I believe you have to go through the registry (under HKLM\System\CurrentControlSet\Enum\Display somewhere) but I'm not sure exactly. That'll contain the raw EDID string which you'll have to parse, Wikipedia describes the format of the EDID string. The parameters you want are the "Maximum Horizontal Image Size" and "Maximum Vertical Image Size".

As I said though, the simplest solution is to just assume your users have a modicum of sanity and don't set their resolution to a 4:3 ratio when they've got a 16:10 monitor...

Share this post


Link to post
Share on other sites
I was wondering what I am going to do with user that have an ratio other than mine too :( It is such a pain in the butt.

If you are using DirectX 10, DGXI has a means of getting the possible resolutions, native resolution, and current resolution.

I don't think I'd worry about getting the physical resolution though. If the user is really silly enough to use a 4:3 when they have a 16:9, then I'm sure they will realize where things went wrong.

I think I'm going to have to create textures and put them in seperate folders with my application for each ratio. a 4:3 copy, a 16:9 copy, etc. I don't see how to use the same texture for different ratios without stretching making it look ugly? Does anyone else?

I mean a button that says "QUIT" created in 4:3 is going to look funny if I just scale it to 16:9, no?

Share this post


Link to post
Share on other sites
You can just build the UI assuming 4:3 and then center it horizontally on a 16:9 screen. If you're displaying the game screen, players with a widescreen monitor will see a little more of the playing field (in the horizontal direction).

Also, in computer monitors, 16:10 is actually more common than 16:9 (so you get 1920x1200 or 1280x800, rather than 1920x1080 or 1280x720). At least, that's been my experience.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!