Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Professional Discussion / Eyefinity multiple monitor display detection

Author
Message
Adrian
21
Years of Service
User Offline
Joined: 11th Nov 2003
Location: My Living Room
Posted: 10th Feb 2012 22:19 Edited at: 10th Feb 2012 22:28
Hi.

I'm having a few problems working out where to put some of my graphics on screen.
For example, I have a screen where there are three control panels with each panel having a number of controls.

In order to make this work in all resolutions, I draw one on the left of the screen (at x=0), one in the middle (at x=screen width()/2 - half the width of the graphic) and one on the right (by subtracting the width of the graphic from Screen Width().)

This allows for all monitor resolutions from 640*480 up to 1920,1080 which I use now.

This works fine except when I run my 3 screen Eyefinity setup. Then I get one on the far left of the left-hand screen, one in the middle of the centre screen, and one on the far right of the right-hand screen.

I need to be able to detect is my program is running on a multiple display or just a single screen. I can't figure out how to do it.

My current Eyefinity display runs at 5760 * 1080

I'm guessing I could see if the screen width is a multiple of 2, or 3, and check this against known common display resolutions, but this seems rather clumsy at best.

I could also take the centre of the screen as the starting point and move my graphics left and right from this location but if I have an odd number of things to display and you are using an even number of monitors (i.e. 2) then one of the graphics will be split down the middle across the two screens (though it would be fine on 3, or 1.)

Can someone tell me of a command that I don't know about?
Please?

The attached image shows the problem with the 5 display bars across the bottom of the screen.

Attachments

Login to view attachments
Millenium7
20
Years of Service
User Offline
Joined: 13th Dec 2004
Location:
Posted: 11th Feb 2012 05:17
i'm not aware of any games that actually 'know' if eyefinity is active, that's kinda the whole point of eyefinity as it should be seamless with any game that supports any resolution.

My suggestion is one of 2

1) preferably just have an option ingame to set eyefinity: on/off and when it's on you simply offset all screen width() commands by 1/3rd, making them appear in the centre. This takes a bit more time to code if you don't already have a menu system, and file saving/reading commands. As ideally you'd want to save the preference so you don't need to set it every time the game is run

2) forget checking against known resolutions, just check screen width() / screen height(). If it's =>1.6 and <1.78 it's either 16:10 or 16:9. If it's =>4.7 then it's eyefinity and adjust accordingly. This method is super quick n easy to code but not as polished
Adrian
21
Years of Service
User Offline
Joined: 11th Nov 2003
Location: My Living Room
Posted: 12th Feb 2012 02:09
Millenium 7
Both of those suggestions are good.

An option asking the user would very quick and easy to do. I never actually thought about asking the user to set it up but it does make sense.

The aspect ratio is good too, but I still wouldn't know if it was one or two screens so could end up splitting the controls over the screen gap.

I guess most people now use 2 screens for Eyefinity gaming as most modernish graphics cards have at least 2 outputs, but 3 is slowly becoming more common.

I think I'm going to simply go with asking the user how many screens are being used via a simple menu choice.

Cheers

Millenium7
20
Years of Service
User Offline
Joined: 13th Dec 2004
Location:
Posted: 12th Feb 2012 05:49
nobody will be playing across 2 screens unless your game natively supports it. The difference between eyefinity and multi monitor setups is that eyefinity merges all screens into 1 single resolution. A traditional multi monitor setup is still just 1920*1080 + another 1920*1080, and running anything in full screen will only see it occupy 1 display (this includes your dbpro program). The exception is running the program in window mode and dragging the window across the 2 screens

So forget about coding for 2 screens. And you would know how many screens there are just by checking for multiples of 1.6 or 1.78 (rounded) as these are 16:10 and 16:9 respectively. So if it's 3.6 it would be 2 monitors, 4.9 is 3 monitors and so on. Some people run slightly iffy resolutions such as 1880*940 (they might be running on a TV and use this to prevent screen cropping), so manually checking for resolutions doesn't work. But checking for aspect ratio will, as long as you add in a bit of leeway

I still think the user option is your best bet. Then go in and replace all your current Xpos image/sprite positioning commands with a seperate function in order to keep things neat and clean. Have the function check a global variable to see if it needs to offset

i.e.



the function will check if it's in eyefinity mode, if it's not it'll just return whichever position you originally specified. If it is then it'll offset coordinates accordingly.
Don't use the offset if you are intending to position something within the middle of the screen, such as a crosshair, otherwise it'll be offset too much. You could certainly make the function smarter by using percentages, more checks and so on
Adrian
21
Years of Service
User Offline
Joined: 11th Nov 2003
Location: My Living Room
Posted: 12th Feb 2012 18:23
That looks really useful, thanks for that.

I can modify it to do the same for the Y axis too so when I win the lottery and get a 6 screen setup (sigh!) it would work with that too (or use 3 screens top to bottom rather than side by side.)

Something to play with in the mean time anyway.
Thanks again

Login to post a reply

Server time is: 2025-06-01 10:20:50
Your offset time is: 2025-06-01 10:20:50