Setting Resolution

BlitzMax Forums/BlitzMax Beginners Area/Setting Resolution

Jason Coggins(Posted 2007) [#1]
What commands allow the program to set the resolution of the computer?

Jason


xlsior(Posted 2007) [#2]
For a full-screen game, or for the desktop itself when running a GUI app?

If you're talking about full screen graphics: simply specify the resolution you want in the GRAPHICS command, and it will switch to that resolution:

graphics 640,480,32,60 -> 640x480x32-bit color at 60 Hz. (The Hz is optional)

If you're talking about the resolution for the desktop, then you probably need to interface with the windows API directly to get it to do that.


Jason Coggins(Posted 2007) [#3]
I am talking about setting the game to a specific resolution with the graphics command and then changing the viewers monitor to match the resolution so it is full screen.

I am currently using the graphics command to set the screen size less then the resolution I am using on the monitor but it is not changing the monitors resolution so the game screen is full screen.

Jason


TomToad(Posted 2007) [#4]
You need to make sure you set a compatible bit depth, the third parameter of the Graphics command. If you don't set it, or if you set it to a value the graphics card does not support, then you might end up with a windowed screen instead of fullscreen.
Example:
Graphics 640,480 <- creates a 640x480 window on the desktop
Graphics 640,480,32 <- sets the monitor to 640x480x32 and makes a window fullscreen


xlsior(Posted 2007) [#5]
Oh -- something else that just occured to me: When you say that it's not full screen: do you mean that is actually running inside of a window on the desktop, or that the image is taking up just part of the screen with black borders around it?

If the latter, then it's a restriction of the video drivers on the computer in question. I've seen some laptops where the drivers force the native pixel resolution rather than stretching the image to the edge of the screen. Could be either a setting in the video drivers, or an option in the computer BIOS.

(On a few laptops, it's not possible to change that behaviour)

If you *do* see the windows desktop behind your game then you're missing the 3rd parameter of the graphics command:

graphics 640,480,32,60

the '32' specifies that you want 32 bit. Other options are '16', '24' (depending on your video card) and '0'. If you choose 0 then it will run the program in a window.


Jason Coggins(Posted 2007) [#6]
I was seeing the windows in the background arround the edges of the window. Changing the third option to 16 or higher fixed it so it is now full screen.

I want the program to run at full screen with windows, linux and the mackintosh. Which bit setting should I use to get a full screen on the most computers on all operating systems?

Also, is there a way to have the program check which bit settings are available on their video card and then have it sellect the bit setting appropriate for their card?

Jason


JazzieB(Posted 2007) [#7]
Yes, you can check ... and it's all in the built-in documentation under Modules > Graphics! Anyway, the following is a little program I wrote a while ago, which simply lists all available modes, unique resolutions, bitdepths, and so on. It's a little over-complicated for your needs, but it should answer your questions.



Basically, the commands you're looking for are CountGraphicsModes() and GetGraphicsModes(). Be aware though that some graphics drivers return a Hz setting as 0! In which case, you'll have to assume these are 60, which is safe.

Hope it helps.