"Graphics3D" and how do I...

Blitz3D Forums/Blitz3D Programming/"Graphics3D" and how do I...

Mustang(Posted 2003) [#1]
OK, I'm stuck. I have a case where I want to set 3D capable windowed screen, using width/height values I choose, like this for example:

Graphics3D 800,600,0,2

But. What if the user has set his desktop to 640*480? *How* can I check the true windows desktop width/height BEFORE setting the "Graphics3D"?

Idea here would be to check the true windows desktop width/height and limit/crop my 3D window to the max windows desktop width/height if my pre-set values are higher than the actual windows desktop width/height.

Any ideas? All the commands available for checking this kind of information do not seem to work in this case (or as usual I'm blind and I'm missing somethig...)

I tried also if Blitz3D would be intelligent enough to limit it all by itself but it really doesnt work properly... try using for example Graphics3D 1600,1200,0,2 on desktop set to 1152*864*32 (my settings but it will be screwy probably with other settings too).


mouss38(Posted 2003) [#2]
i think the best is to give the res choice to user and save it in a file...


Mustang(Posted 2003) [#3]
No I can't do that... that would be easy. Since this would be the FIRST screen the user sees he really can't choose any resolutions because the program has not yet even started! I just want to know if there is an answer to the exact problem I have.


Rob Farley(Posted 2003) [#4]
Create a user32.decls file, or add this line to an existing one:
User32_GetSystemmetrics%( flags% ):"GetSystemMetrics"

Then in BB
nTemp% = User32_GetSystemmetrics(0) ; Width
nTemp% = User32_GetSystemmetrics(1) ; Height


That should do the trick.

Note: This will return the desktop size so you might want to do something like:
screenx = User32_GetSystemmetrics(0)-6 ; Width
screeny = User32_GetSystemmetrics(1)-45 ; Height
to make space for borders and the task bar.


BlitzSupport(Posted 2003) [#5]
This used to work, but I have a feeling it doesn't now (can't check at the moment) -- call GraphicsWidth/Height () *before* you set a graphics mode...


Mustang(Posted 2003) [#6]
OK, what Dr Av suggested seems what I need... just one question: what is "user32.decls file" and how I create those??? :)

James, I'm *pretty* sure that I tried the GraphicsWidth/Height () and it didn't work... but I tried so many things that I might have missed that. Have to check it too again just to make sure.


Mustang(Posted 2003) [#7]
Allrighty... code below gives me w=400 and h=300... on a 1280*1024*32 (LCD) desktop, so...


Global Gw = GraphicsWidth() 
Global Gh = GraphicsHeight() 

; Set a graphics mode and buffer 
Graphics 640,480,16 
SetBuffer FrontBuffer() 

; Print the details 
Print "Screen width is: " + Gw
Print "Screen height is: " + Gh

; Wait for ESC before exiting 
While Not KeyHit(1) 
Wend 



Mustang(Posted 2003) [#8]
Ah, found it! (And it seems that I'm not the first one to ask this GetSize thing, duh):

http://www.blitzbasic.co.nz/bbs/posts.php?topic=21501


Mustang(Posted 2003) [#9]
And more questions... is the "User32_GetSystemmetrics%( flags% )" same as the stuff in here:

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/sysinfo/base/getsystemmetrics.asp

...And how can I get access to those?


Hotcakes(Posted 2003) [#10]
I thought Blitz3D had DesktopWidth()/DesktopHeight()/DesktopDespth() commands? Was I dreaming or something =]


Mustang(Posted 2003) [#11]
Was I dreaming or something =]


Dreaming? :)

http://www.blitzbasic.co.nz/b3ddocs/command_list_3d_a-z.php?show=D

Anyways, the decls thing described above by Dr Av works 101% OK, so "problem solved"!


Rimmsy(Posted 2003) [#12]
that's blitzPlus, hotcakes.

matt