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.

Code Snippets / [DBP/DBC] Function to set best available screen solution

Author
Message
Attila
FPSC Reloaded TGC Backer
20
Years of Service
User Offline
Joined: 17th Aug 2004
Location:
Posted: 23rd Apr 2008 18:28 Edited at: 16th May 2008 15:58
The function uses DBs checklist for display modes to determinate the 'best' available screen resolution (Where 'best' is the resolution with the most pixels). It works in DBC & DBP and can be used in the init-part of any program to overwrite the display mode set by DB.

It allows to adapt your application to any available screen format (which can be helpfull when you develop on a 4:3 screen and the user uses a 16:9 display).

Master Xilo
18
Years of Service
User Offline
Joined: 8th Sep 2006
Location: Bern, Switzerland
Posted: 20th May 2008 21:34 Edited at: 20th May 2008 21:35
hmm, it shouldn't ignore the depth:

Attila
FPSC Reloaded TGC Backer
20
Years of Service
User Offline
Joined: 17th Aug 2004
Location:
Posted: 22nd May 2008 15:26
yes, but what is 'better' 640x480x32 or 1024x768x16? as a gamer in most games I prefer 1024x768 to see more details even if there are 'only' 65000 colors instead of millions.

but this is up to you.
Master Xilo
18
Years of Service
User Offline
Joined: 8th Sep 2006
Location: Bern, Switzerland
Posted: 22nd May 2008 20:05
1024x768x32 will give you as much details as 1024x768x16
and won't run noticeable slower on today's pc's
Attila
FPSC Reloaded TGC Backer
20
Years of Service
User Offline
Joined: 17th Aug 2004
Location:
Posted: 22nd May 2008 22:10 Edited at: 23rd May 2008 15:46
agreed, but my graphic card (ati 9250) will support only 16bit at 1024x768 but 32bit at 640x480
Master Xilo
18
Years of Service
User Offline
Joined: 8th Sep 2006
Location: Bern, Switzerland
Posted: 22nd May 2008 22:25
ah ok
dark coder
22
Years of Service
User Offline
Joined: 6th Oct 2002
Location: Japan
Posted: 23rd May 2008 11:00
By default I always use the user's desktop resolution, I can't stand games that start in 640x480 or something, if I wanted to run that low wouldn't my PC be set to this by default? Besides, if someone's PC fails so much that they can't run a game at their desktop resolution(i.e. they cannot execute it to change this), then they should have no business playing my game . Though usually I have a config file somewhere that allows the user to force it to use whatever size they wish.

Attila
FPSC Reloaded TGC Backer
20
Years of Service
User Offline
Joined: 17th Aug 2004
Location:
Posted: 23rd May 2008 15:48
DBC always starts with 640x480 when not set to a different resolution. How do you determine the desktops resolution?
Master Xilo
18
Years of Service
User Offline
Joined: 8th Sep 2006
Location: Bern, Switzerland
Posted: 23rd May 2008 19:49 Edited at: 23rd May 2008 19:49
like this:

Attila
FPSC Reloaded TGC Backer
20
Years of Service
User Offline
Joined: 17th Aug 2004
Location:
Posted: 24th May 2008 00:09
Great thanks
bjadams
AGK Backer
16
Years of Service
User Offline
Joined: 29th Mar 2008
Location:
Posted: 1st Jun 2008 12:44
i use 1024x768 fixed resolution for my game.

this works well for 4:3 screens, but on 16:9 screens all is stretched. is there are elegant way to fix this problem?
NeX the Fairly Fast Ferret
19
Years of Service
User Offline
Joined: 10th Apr 2005
Location: The Fifth Plane of Oblivion
Posted: 6th Jun 2008 17:48
If you are using any 3D, you can use SET CAMERA ASPECT to adjust the aspect ratio. It will not affect 2D, however.


I fail at life. No, really.
Attila
FPSC Reloaded TGC Backer
20
Years of Service
User Offline
Joined: 17th Aug 2004
Location:
Posted: 29th Jul 2008 17:53 Edited at: 29th Jul 2008 17:57
When using my routine the game will stretch to the screen but all positioning and movement in 2D must be done with factors of screen width.

a.e moving from left to right would be
like:
Quote: "

load image "myimage.bmp", pic
delta=screen width()/100

do
sprite pic,xpos,ypos,pic
xpos=xpos+delta
sync
loop

"


Or you could use a windowed mode, then it will stay in 4;3 format.

Login to post a reply

Server time is: 2024-11-25 10:01:29
Your offset time is: 2024-11-25 10:01:29