Screen ratios

BlitzMax Forums/BlitzMax Programming/Screen ratios

ta jazzie:

yeah ideally i would be making sure everyone sees the same thing regardless of what res they are running/capable of running at.

All said and done, I think I have found how do go about doing the alternative (which is drawing everything at the middle of the screen.

Import chaos.desktopext
Global Desktop_Width:Int = DesktopWidth()     'Get the width of the current desktop
Global Desktop_Height:Int = DesktopHeight()    'Get the height of the current desktop
Global Desktop_Depth:Int =  DesktopDepth()     'Get the depth of the current desktop

Global Screen_Width:Int = 800
Global Screen_Height:Int = 600

Graphics Desktop_Width,Desktop_Height,Desktop_Depth
SetViewport ((Desktop_Width - Screen_Width)/2,(Desktop_Height - Screen_Height)/2,Screen_Width,Screen_Height)

SetOrigin (Desktop_Width - Screen_Width)/2,(Desktop_Height - Screen_Height)/2

While Not KeyDown(Key_escape)

	SetColor 128,0,0
	DrawRect 0,0,800,600
	DrawRect -20,-20,10,10
	DrawRect Screen_Width + 10,Screen_Height + 10,10,10	
	SetColor 64,0,0
	DrawRect 1,1,798,598
	DrawRect -19,-18,8,8
	DrawRect Screen_Width + 11,Screen_Height + 11,8,8
	
	SetColor 255,255,0
	DrawLine -50,300,850,300
	DrawLine 400,-50,400,650	
	
	
	Flip; Cls

Wend

End

I'll let the user decide what res they want to run at and whether they want it stretched too :)