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.

Newcomers DBPro Corner / Obtaining max screen size of a computer and changing the resolution automatically

Author
Message
Simon Huggins
16
Years of Service
User Offline
Joined: 25th Mar 2008
Location:
Posted: 8th Apr 2008 18:50
Hi, I have wriiten a routine for my game so that it finds out the maximum resolution of the computer it is running on and then attempts to change the resolution to that maximum. For example if a system was currently running at 1024x768 at 16 bit colour depth, but could display 1280x1024 at 32 bit colour depth it would change the resolution to that higher resolution. I have experienced 2 problems so far:-
1) Some of the graphics card statements seem to be now obsolete.
2) It works on my computer & my dad's old laptop, but seems to get the resolution back to front on my friends Dell system.
What am I doing wrong and/or is there an easier way to code a solution to this problem.

Attachments

Login to view attachments
Simon Huggins
16
Years of Service
User Offline
Joined: 25th Mar 2008
Location:
Posted: 8th Apr 2008 19:27
For some reason although I thought I uploaded the source code, the pink download button downloads the executable which is pointless onn this occasion. Sorry about that. Here is the code:-

perform checklist for display modes
maxwidth=0: maxheight=0: maxdepth=0
for c=1 to checklist quantity()
width=checklist value a(c)
height=checklist value b(c)
depth=checklist value c(c)
print "found:";checklist string$(c)
if width*height*depth>maxwidth*maxheight*maxdepth
maxwidth=width
maxheight=height
maxdepth=depth
endif

next c
set display mode maxwidth,maxheight,maxdepth

sync on
sync rate 1000

global screen_width
global screen_height
screen_width=screen width()
screen_height=screen height()
Simon Huggins
16
Years of Service
User Offline
Joined: 25th Mar 2008
Location:
Posted: 8th Apr 2008 22:18
That's a good point WindowsKiller. But that's what my routine is trying to avoid in the first place. ie if I just state a preffered resolution with the set display mode command the program will not work on some machines. My game should ideally run in 1280x1024 but can run at the lowest resolution of 1024x768. It will also run on a wide screen machine of 1280x800 using this routine. I have tested it on 5 different machines so far and the problem only happens so far on 1 machine with the same sized monitor as mine. I certainly don't want to adopt any bad practices, but I do need the flexability so that it can work on as many machines as possible. What's the best way of achieving this goal without causing the possibilty of some poor soal being left with a blank screen unable to get back and restore the display?
Simon Huggins
16
Years of Service
User Offline
Joined: 25th Mar 2008
Location:
Posted: 8th Apr 2008 22:50
Another point I forgot to mention is this. I thought I would leave out the set display mode command altogether, hoping that the game would run at whatever resolution the system was currently set to. However, the programs seems to run in a much lower default resolution which is certainly not what I want to happen.
Cloggy
20
Years of Service
User Offline
Joined: 31st Oct 2004
Location: Rayleigh, Essex
Posted: 10th Apr 2008 14:25
You can use Ianm's dll or my d3dfunc dll to get the current desktop size and then use that to set the display mode to match.



IanM
Retired Moderator
22
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 10th Apr 2008 20:01
That's not the same though. I'm not sure that there is a proper solution to this as no-one seems to install proper monitor drivers any more, simply because you don't need to to get your system running.

Twinsen
18
Years of Service
User Offline
Joined: 20th Jun 2006
Location: Romania
Posted: 10th Apr 2008 20:45
it's virtually impossible to check for the monitor's supported modes ... as IanM said, if the monitor WOULD be installed correctly, it would "agree" with the videocard to a common-supported maximal resolution and depth mode, but because people just use the default Plug & Play drivers, you can only hope for the best ... anyway, in my game, I check for the graphic card's supported modes and inside the FAQ section of the manual, I attention users not to set the resolution or bitdepth to a higher mode than the ones which the monitor supports

Could you help me treat my injured Dino-Fly ?
Sasuke
18
Years of Service
User Offline
Joined: 2nd Dec 2005
Location: Milton Keynes UK
Posted: 10th Apr 2008 20:56 Edited at: 10th Apr 2008 20:57
Nevermind.
Simon Huggins
16
Years of Service
User Offline
Joined: 25th Mar 2008
Location:
Posted: 12th Apr 2008 17:53
Thanks everyone for your feedback so far. Twinsen, you say that in your game you check for the graphics card's supported modes. How do you achieve that? Is it similar to the way I have done it. I think Ideally, I would start off with a resolution that most people could view no matter what monitor or graphics card they were using. Then give an option in the game to set it more suitably for their own requirements. I would put a small safety routine in there too. Like printing a message "Is this new screen resolution suitable? Please type YES" And if they don't because their screen is blank, after about 5 seconds or so the game will put the settings back to how they were. What ever I do however, I'm not too bothered about the monitor, it is accessing the graphics cards supported modes that I want to get a grip on. And I want to do it reliably no matter what machine it runs on.

Login to post a reply

Server time is: 2024-11-25 06:26:03
Your offset time is: 2024-11-25 06:26:03