DarkBASIC Pro Turorial: Display Settings

James Cloud
Most professional games give the user the option to change the screen resolution, colors, and other features that pertain to the display.

This tutorial will show you how to modify the various settings of the users display screen.

Part One - Window Basics

There are several commands in DarkBASIC Pro that allow you to change the basic appearance of you application or game. Here a few of them:

SET WINDOW TITLE; this command will change the text in the title bar of your application. You must provide your desired title text string as a parameter.

You can use the SHOW WINDOW and HIDE WINDOW commands to easily show and hide your game. No parameters are required for these functions.

SET GAMMA changes the screens red, green, and blue gamma settings. Simply supply your desired red, green, and blue settings in integers, up to 255, as parameters.

Part Two - Resolution and Colors

You can change the size of your game's windows by using the SET WINDOW SIZE command, as shown below.

Example:

SET WINDOW SIZE 1024, 768

This will change the application's window size to 1024 x 768, however it will not change the computer screen's resolution. SET WINDOW SIZE is useful if you allow a windowed mode option in your game.

If you wish to change the actual resolution of the screen and the color depth use the SET DISPLAY MODE command. You must the give the desired width, height, and color depth as parameters.

Example:

SET DISPLAY MODE 1280, 1024, 32

The code given above will change the screen's resolution to 1280 x 1024 and set the displays color depth to 32 bits.

It is wise to give the user the option to change the resolution, because not all resolutions work well on all systems and monitors. For example, some LCD monitors native resolutions are 1280x1024 when some others are quite higher.

Part Three - Enumeration

Now that you have learned how to set various display settings for your game or application it is time to learn how to retrieve settings pertaining to the system display.

In some cases, people will have more than one graphics card installed inside their computer. You can get a list of graphics cards in a system by using the PERFORM CHECKLIST FOR GRAPHICS CARDS function.

You can retrieve the current frames per second, or FPS, that your application is running of by using the SCREEN FPS() function as an integer.

You can get the entire desktops width and height by using the DESKTOP WIDTH and DESKTOP HEIGHT commands.

To check to see if a resolution is supported on the current machine simply call the CHECK DISPLAY MODE function and pass the desired width, height and color depth as parameters.

End

Using the commands and functions profiled in this tutorial you should be able to make your DarkBASIC Pro game not only appear more professional, but actually make it truly more professional.

Published by James Cloud

I like to program and do basically anything that has to do with technology and computers.  View profile

1 Comments

Post a Comment
  • Zabalac the Overlord10/17/2010

    Helpfull

To comment, please sign in to your Yahoo! account, or sign up for a new account.