DesktopWidth() and DesktopHeight() broken

Archives Forums/BlitzMax Bug Reports/DesktopWidth() and DesktopHeight() broken

GfK(Posted 2010) [#1]
Both report the graphics resolution in fullscreen mode, rather than the desktop dimensions (BMX 1.39).

Strict

'test in windowed
Graphics 800,600,0
While Not KeyHit(KEY_SPACE)
	Cls
	DrawText "Desktop reports as: " + DesktopWidth() + "x" + DesktopHeight(),10,10
	DrawText "SPACE TO CONTINUE...",10,40
	Flip
Wend

'...and in fullscreen...

Graphics 800,600,32
While Not KeyHit(KEY_SPACE)
	Cls
	DrawText "Desktop reports as: " + DesktopWidth() + "x" + DesktopHeight(),10,10
	DrawText "SPACE TO QUIT...",10,40
	Flip
Wend

End



Hujiklo(Posted 2010) [#2]
I found this, I had to run it once before the game starts properly and save to globals for future reference.


jkrankie(Posted 2010) [#3]
you'd want to do this before changing the desktop resolution surely, which is effectively what Graphics() does if you're opening a fullscreen context.

Cheers
Charlie


GfK(Posted 2010) [#4]
Well, either way, 800x600 is not my desktop resolution! DesktopWidth/Height should always return whatever dimensions the desktop is set to in Windows* since there is no other reason for using these commands.

* or any other OS you might be using.


marksibly(Posted 2010) [#5]
Hi,

Same thing is happening on the Mac, so at least it's consistent!

Alas, I'm not aware of a way to determine the *real* desktop params. I've tried a few methods, and they all just return the same thing - the current display size. Even GetDesktopWindow() is returning the new size, so it could be argued it IS correct!

I could cache the desktop values at startup, but this wouldn't detect desktop size changes while the app was running, or take into account an app astarted by another fullscreen app - as if that would even work!

Anyway, I'm just gonna leave it as is for know unless someone has an better ideas.