Detecting a widescreen monitor

Started by
10 comments, last by Programmer16 15 years, 3 months ago
Using DirectX is there a way to detect whether a monitor is widescreen or not before device creation? I was thinking of making a method that gets the adapter's current display mode and calculating aspect ratio from that. But, many widescreen monitors support 4:3 resolutions and the above method would give me incorrect results if the widescreen monitor is using a 4:3 resolution. So, what I'm looking to do is use or make a method similar to the XNA GraphicsAdapter.IsWidescreen property. Any ideas?
Advertisement
If I'm correct, the GraphicsAdapter.IsWideScreen just tells you whether or not the current display mode is widescreen.

I have to ask though, why does it matter? You shouldn't care whether or not it's a widescreen monitor; you should only care what resolution the user wants (or is using at the moment.)

My best recommendation would be to use your idea. Use GetDisplayMode() and you can tell from there whether or not they're using a widescreen resolution. AFAIK, there isn't a way to differentiate from fullscreen monitors from widescreen monitors.
If you're about to create your device, you know your target resolution, which is either user specified in your game's video settings or simply the current display mode. Just check what aspect ratio that is. The actual monitor's physical dimensions are none of your business.
SlimDX | Ventspace Blog | Twitter | Diverse teams make better games. I am currently hiring capable C++ engine developers in Baltimore, MD.
What promit said, it's actually easy once you know the resolution (p-code):
int width;int height;...float normalRatio = 4.0 / 3.0;float widescreenRatio = 16.0 / 9.0;float currentRatio = float(width) / float(height);if (currentRatio near widescreenRatio) {    // is widescreen} else if (currentRatio near normalRatio) {    // is "normal"} else {    // is funky}
Quote:Original post by Programmer16
If I'm correct, the GraphicsAdapter.IsWideScreen just tells you whether or not the current display mode is widescreen.

I have to ask though, why does it matter? You shouldn't care whether or not it's a widescreen monitor; you should only care what resolution the user wants (or is using at the moment.)


Because people want to know! Especially gamers!

I've played many games that include format information next to each resolution (4:3, 16:9, widescreen).

In fact, I would always add this. People want to know if they're selecting a widescreen format or not.
They don't want to do long division in their head to figure it out.

[Edited by - samster581 on January 7, 2009 3:22:43 AM]
It's worthwhile finding out the physical aspect ratio if you want your game to look right when someone uses a resolution that has a different aspect ratio to the monitor. Everything will look stretched if you don't use the physical aspect ratio.

The API for finding the physical monitor size on Windows is GetDeviceCaps().
The user can change the display resolution at any time(well, its good for a game to provide this functionality). It wont be 4:3 or 16:9 aspect...its ridiculous to let the user stuck at only these two values. Its much easier to, everytime the resolution changes, you compute the new aspect ratio and your new projection matrix.
.
Quote:Original post by phresnel
What promit said, it's actually easy once you know the resolution (p-code):
*** Source Snippet Removed ***


you shouldn't forget about 5:4 and 8:5 (16:10) monitors, they're actually extremely common. (perhaps even more common than 4:3 and 16:9 these days on computer monitors)
[size="1"]I don't suffer from insanity, I'm enjoying every minute of it.
The voices in my head may not be real, but they have some good ideas!
GetDeviceCaps is not accurate sometimes (I have found on laptops, it seems to take in to account from the top edge of the plastic on the screen down to the bottom of the laptop, which can serious throw off calculations, but I have no idea how this works under the hood, probably the laptop manufacturers fault somehow.)
In the video setup for my game I let the user choose their res returned from the card and then I also let them manually select the aspect ratio. I support 4:3, 5:4, 16:9, and 16:10, now this does let users do something stupid like 800x600 at 16:10 but that is their choice. The only downfall is I have locked my menu into 1024x768 at 4:3.

This topic is closed to new replies.

Advertisement