Resolution selected causes display to rotate 90deg

Blitz3D Forums/Blitz3D Programming/Resolution selected causes display to rotate 90deg

Matty(Posted 2010) [#1]
Good Afternoon,

A while ago I wrote a game, which we still play at work occasionally (multiplayer space combat). These work pcs mostly have intel on board cards - which is fine for bog-standard blitz3d.

Anyway I now use a simple text file to determine the screen resolution to set - user only needs to set it once usually.

However at one point I used an 'auto detect' method which simply chose the largest screen resolution (width * height) from those available on the graphics card, as reported by blitz3ds gfxmodeexists functions.

On some of these intel machines however, though not all, the display would then rotate by 90 degrees making play virtually impossible (until we get zero-g environments so we can sit at any angle).

Is there a 'safe' way to autodetect the maximum screen resolution available, aside from simply picking the mode with the largest screen area as reported by blitz3d.

These machines were running any of XP & Vista at the time.


Axel Wheeler(Posted 2010) [#2]
It seems that if the graphics mode starts with the larger value (say, 1024 x 768) then it will be horizontal, otherwise (i.e. 768 x 1024) vertical. Just have the auto detect skip the ones where the first value is smaller than the second.

However, keep in mind that at least with CRT monitors you also had to worry about the refresh rate of the graphics card potentially damaging the monitor, especially at the highest res setting. At low res there was more flexibility but the highest resolution often had only one "legal" refresh rate (hz) and any other refresh rate could "let the magic smoke out" after a few minutes. I don't know if this is true with today's flat panels though. Just an FYI when you are using the highest resolution on the card.

- Pete


Rroff(Posted 2010) [#3]
Modern flatpanels will either blank out and show a message saying "unsupported resolution or refresh rate" or display the image (blurrily) through the onboard scaler using native res/refresh.


Rroff(Posted 2010) [#4]
Dunno if this is any use to you - or been covered here before but this is what I use;

In my userlibs for user32.decls I have:

.lib "user32.dll"
GetSystemMetrics%( iMetric% ) : "GetSystemMetrics"

Then in my program I use

Const SM_CXSCREEN = 0
Const SM_CYSCREEN = 1

vidx = GetSystemMetrics(SM_CXSCREEN)
vidy = GetSystemMetrics(SM_CYSCREEN)

To get the current screen resolution and use that to set it in my program if the user hasn't defined a res.