Screen ratios

BlitzMax Forums/BlitzMax Programming/Screen ratios

Raz(Posted 2006) [#1]
Right,

I am programming my game at 800x600 and I would like to make sure regardless of what screen res you use, the pixels stay square.

Like for my screen (1440,900) I will want some vertical borders to the left and right. But someone running 1600x1200 will not require borders.

Failing that, I would be happy with the game using the current windows res and just sticking the 800x600 view in the middle.

I hope that makes sense to someone! I dont know too much about the graphics commands so don't really know where to start. I had a search but anything I found is now redundant

ta!


GfK(Posted 2006) [#2]
1440x900, 800x600 and 1280x1024 are all different aspect ratios.

I don't have a 16:9 monitor to test on - If people fork out for a widescreen monitor are they going to be happy with black borders at either side?

Not really sure of the best way of tackling this one, myself.


Raz(Posted 2006) [#3]
yeah im aware they are different aspect ratios, thats the problem I am trying to overcome I spose. 800x600 really doesnt look too hot when stretched in widescreen, id rather it maintain the 4:3 ratio as best as it can.


JazzieB(Posted 2006) [#4]
You could use the extra space to display additional information about a player's progress. Obviously this couldn't be essential information otherwise those using 4:3 monitors would be playing at a disadvantage (unless they had a way of accessing it during play). Also, the information that you already display could be moved into this area.

Also, you could consider displaying more of the play area to widescreen users. Although the advantage over 4:3 users is here again, in which case you could allow 4:3 players to play the game in widescreen format, i.e. with bars at the top and bottom of the screen.


Raz(Posted 2006) [#5]
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 :)