HORZSIZE and VERTSIZE DeviceCaps

These are supposed to give the physical size of the screen i millimeters. But I noticed they differs between resolutions. Does anyone know what this means, and what implication it has?
AFAIK this is just straight-up Windows API nonsense. It was supposed to give the physical dimensions, but people were using it for other things back when the physical size of the monitor wasn't known (it only started being known with VESA spec connectors et al), so I think they decided, in their infinitesimal wisdom, to leave it broken in some way. Don't quote me on that, though :)

You can get the actual physical size of the monitor if you want it, but it's an absurd hunt involving SetupAPI that's like 500 lines of code or something ridiculous like that :(

- Casey
cmuratori

You can get the actual physical size of the monitor if you want it, but it's an absurd hunt involving SetupAPI that's like 500 lines of code or something ridiculous like that :(

- Casey


Thanks for quick answer.

If I measure the dimentions of a 16:9 screen, and use those as constants to generate a pixelpermillimeter (vert/horz) ratio, this works on my screen, in all resolutions. But could it become horribly wrong on some other screen? What if I can find the ratio on the destination screen, and use my "constants" to modify one of the axis. Will that work reliably?
No, it never works reliably to estimate based on the resolution, because monitors have different DPIs. So basically your estimate would only be correct for monitors with the same DPI as your monitor. If you need to know the physical dimensions of the monitor accurately, you have to get them from the VESA-spec backchannel (which should work reliably on all displays in use today, I would suspect).

- Casey
Thanks.
And what problems will I have if I chose an internal unit that is a percentage or a
thousandth of the screenwidth/height in pixels?

I just tested this now. Internally I use a 1/1000 of the HORZRES and VERTRES. This seem to work ok.

But I dont know if it would solve or increase my problems? Even if it is not a DPI, it is a Dot per thousandth of the screens real estate.

Such that if I select 80% of my vertresolution for my TILEMAP, in this unit, then it looks similar proportionally in all resolutions? Would that be an acceptable compromise?

Edited by Livet Ersomen Strøm on
It depends on what you're trying to do. If you're trying to make sure that it looks the same "size" no matter what the physical resolution of the display, then no, that doesn't help, because the logical resolution and the physical resolution of devices are unrelated.

You can have a 24" monitor and an iPhone that both have the same resolution, right. Or two iPhones where one has twice the resolution of the other, so your game would look twice as small (or four times as small, area-wise) on one than the other.

- Casey
:(

And I thought I'd been so smart now? This works even if I change the DPI settings in Windows7. What my other test did not.

But isn't this what we want? That if we draw a picture in fullscreen, that it will FILL the entire screen on both devices?

And will it not do that then?

I understand that if i want something to be exactly 100 millimeters on any display, this cant work.

But in my mind, what we want is to represent the same amount of tiles, or the same proportions such that a logical meter, looks roughly like a logial meter on both devices? Such that a controlpanel places on 20% of the screen, to the right, would still fill 20% of the screen on all devices?

And such that a movement of so an so many units on one device moves the player, on screen, roughly the same amount of screen relative distance, on both devices?

I thought that the point was for them both to see roughly the same. If the resolutions are the same, then it would also look the same, and feel the same, the way I see it? And if the resolution on the target was very small, the graphic would suffer, but it would still appear to be roughly the same image. The details would differ.

But for two devices with the same amount of pixels, the details would not differ/suffer.

I dont understand.