B3D demo

Blitz3D Forums/Blitz3D Programming/B3D demo

julianbury(Posted 2004) [#1]
I just downloaded Blitz3D to try.
It looks very nice, a bit intimidating but nice.
I already own Blitz+ and I like to make my games use the current desktop screen mode as that is what the user is likely to have optimised his/her setup for.

In Blitz+ I find the resolution this way:
Global xres=GadgetWidth(Desktop()) - 6		; fit the left-right frame in the screen
Global yres=GadgetHeight(Desktop()) - 22	; fit the top-bottom frame in the screen

The GadgetWidth(Desktop()) command does not seem to work in Blitz3D.
Is there an alternative?

Thank you in anticipation


Al Mackey(Posted 2004) [#2]
There is no native command like this, a fact which really annoys me, but it's really easy to get this info from the Windows API through a UserLib.

What you do is make a declares file (I call mine "User32.decls") in the B3D userlibs directory, and put this in it:
.lib "user32.dll"
User32_GetSystemmetrics%( flags% ):"GetSystemMetrics"

This allows Blitz to access a function called GetSystemMetrics in user32.dll (which all Windows versions have), which can return desktop resolution (as well as other useful info). For example:
DesktopWidth = User32_GetSystemmetrics(0)
DesktopHeight = User32_GetSystemmetrics(1)



julianbury(Posted 2004) [#3]
Thank you, Al Mackey.

That's really useful :-))