Here is some code that retrieves all of the available screen modes that are supported on the PC that your app is running on, you can specify the minimum width/height/bpp requirements and a list is returned of only the screen modes that match.
At least this will help take the guesswork out of choosing a screen mode and allow you to match the native display much better at fullscreen - eg my laptop supports 800 x 600 - but then circles become ovals because the screen mode is stretched to fit the widescreen aspect ratio - so your game/application may prefer to choose a widescreen friendly screen mode instead.
Here is how you use it to return all the screen modes that are at least 800x600 at 32bpp:
GetScreens(800, 600, 32)
for i = 0 to GetArrayElements(screens(), 1)
print Str$(screens(i).Width) + " x " + Str$(screens(i).Height) + " x " + Str$(screens(i).BPP) + " " + Str$(screens(i).Frequency) + " Hz"
800 x 600 x 32 60 Hz
1024 x 768 x 32 60 Hz
1280 x 800 x 32 60 Hz
1440 x 900 x 32 60 Hz
To get a complete list of all supported screen modes use the following but note that any BPP modes < 16bpp cannot be used by PlayBasic:
GetScreens(0, 0, 0)
... and here is the interesting bit:
Dim screens(0) as ScreenInfo
PSUB GetScreens(minWidth, minHeight, minBPP)
DLLid = GetFreeDll()
LoadDll "User32", DLLid
DLLCallConv DLLid, 0
createbank 1, 200
i = 0
count = 0
result = CallDll(DLLid, "EnumDisplaySettingsA", 0, i, GetBankPTR(1))
if result = 1
screenWidth = PeekBankInt(1, 108)
screenHeight = PeekBankInt(1, 112)
screenBPP = PeekBankInt(1, 104)
screenFreq = PeekBankInt(1, 120)
if screenWidth >= minWidth
if screenHeight >= minHeight
if screenBPP >= minBPP
ReDim screens(count) as ScreenInfo
screens(count).Width = screenWidth
screens(count).Height = screenHeight
screens(count).BPP = screenBPP
screens(count).Frequency = screenFreq
until result <> 1
Here's a question I hope someone (Kevin?) can answer: If there are two identical screen resolutions except for the frequency, eg 1024x768 32BPP but with 60Hz and 75Hz frequencies which one will PlayBasic use? Does it even matter and if it does can/will OpenScreen be extended to allow this selection?
Hope someone finds the above of use.