Setting to Desktop Resolution

BlitzMax Forums/BlitzMax Programming/Setting to Desktop Resolution

AAM(Posted 2005) [#1]
I posted this question in another topic under the BMax Beginner's area, but so far haven't received a sufficient answer; so I'm gonna' post it again here:

Does anyone know how to set the Graphics width and height to that of the user's current desktop resolution in BlitzMax? In BlitzPlus/2D you could use the following statement: "Graphics GraphicsWidth(), GraphicsHeight()", but in BlitzMax, the GraphicsWidth/Heigth() functions only return '0' when called before the graphics mode is initiated.

If I have to resort to Win API calls to accomplish this, then I'm all ears; so if there is someone experienced with calling Win API functions in BMax and know the one for getting the user's current resolution; please feel free to let me know.

The goal of this is to initiate the graphics mode without suffering the delay experienced by monitors after changing resolutions.

Any help is most appreciated. Thanks!


Chris C(Posted 2005) [#2]
The goal of this is to initiate the graphics mode without suffering the delay experienced by monitors after changing resolutions.

now thats a good idea

try this....

Import pub.win32

Extern
Function GetDesktopWindow:Int()"win32"
Function GetWindowRect:Int(hWindow:Int,r:Byte Ptr)"win32"
End Extern

Global r:Int[4]
Global p:Byte Ptr=Varptr(r[0])
hWnd=getdesktopwindow()

GetWindowRect(hwnd,p)
Print r[0]
Print r[1]
Print r[2]
Print r[3]


Muttley(Posted 2005) [#3]
That's useful, thanks.

Any idea how to do a similar thing on OS X and Linux?

Muttley


TeaVirus(Posted 2005) [#4]
If you have the GUI mod you can use GadgetWidth(Desktop()) and GadgetHeight(Desktop()). Also, when using dual monitors ClientWidth(Desktop()) and ClientHeight(Desktop()) seem to return the dimensions of the primary monitor only (at least for me it does).


Muttley(Posted 2005) [#5]
Ah, a much tidier way. :)

Thanks

Muttley


FlameDuck(Posted 2005) [#6]
Or you could just go with Desktop().width and Desktop().height.