EXAMPLE SOURCE CODE



 Retrieve list of PlayBasic screen modes

By: Adrian Nelson (AdeN) Added: September 20th, 2007

Category: All,Screen


Hi,

This code (see attached file) will populate an array with the width, height and bits per pixel (bpp) of all the supported PlayBasic screen modes that are available on the PC.

You can also specify a minimum width, height and bpp that you want returned, for example:

GetScreens(800, 600, 0) - will return a list of all screen modes that are 800 x 600 pixels or larger.

GetScreens(0, 0, 32) - will return a list of all screen modes that support 32 bpp

I have also attached a small screenshot that shows all of the 32 bpp modes on my laptop - from 320 x 200 all the way up to 1440 x 900

You may be wondering why you should care - surely 800 x 600 fullscreen is available on all PCs? Well quite often it is, however on a widescreen display this gets stretched to fill the screen and all of your carefully created graphics get distorted as a result. So it would be better to try and match the aspect ratio of the possible screen modes to the returned list.

Also, you can then allow the user to select the screen size to run the game at knowing that you are only offering them the screen modes that you want them to be able to pick from.

I hope that you find this of use in your own games/applications.


Download: Login to Download





Release Type: The source code & tutorials found on this site are released as license ware for PlayBasic Users. No Person or Company may redistribute any file (tutorial / source code or media files) from this site, without explicit written permission.


 

 
     
 
       

(c) Copyright 2002 / 2024 Kevin Picone , UnderwareDesign.com  - Privacy Policy   Site: V0.99a [Alpha]