Screen resolution? What to do?

BlitzMax Forums/BlitzMax Beginners Area/Screen resolution? What to do?

Arabia(Posted 2011) [#1]
What should I do about screen resolution when my program is run on a widescreen monitor? I would like to run it in full screen. The backdrop of the game is 1024x768 which is think is absolute minimum for any monitor/video card these days.

My native resolution on my laptop (widescreen) is 1366x768. I don't want to run in this resolution as I believe plenty of people are still using standard monitors.

If I run the game in 1024x768 mode, full screen on my laptop then the image is stretched to fill the screen - which would be okay but it doesn't maintain the aspect ratio and this stuffs up isometric graphics.

I know this has probably been asked, can you get the current desktop resolution when a game starts?

What I'm thinking is:
1. Get resolution (returns 1366x768) in my case
2. Set origin of (1366-1024/2, 0)

This will leave two black areas on either side of the game 'screen' which I think is acceptable.

Any ideas?


Zeke(Posted 2011) [#2]
Print DesktopWidth() + "x" + DesktopHeight()


Arabia(Posted 2011) [#3]
Thanks Zeke.

Is the way I'm proposing on doing this (with the blank area's down the left & right on widescreen) the way I should be doing it?

Another question (don't want to flood the forum with simple questions)

I want to overlay my normal screen with a "tinted" looking rectangle to show information, and then put the screen back to normal.

I get a nice effect using SetBlend(SHADEBLEND) but when I try to redraw my graphics to get rid of this rectangle, everything is drawn darker? What do I need to set my blend back to? i.e. what is the BM default value for Blend?

This is the code I have which doesn't work:




Arabia(Posted 2011) [#4]
Ignore my last question, forgot to set the colors back after changing them to (128,128,128)

Code in case any other newbie wants to do this sort of effect:




Jesse(Posted 2011) [#5]
setViewPort used to be a problem with some older intel graphics cards. Use at your own risk.
Local dw:Int = DesktopWidth()
Local dh:Int = DesktopHeight()
Local cx:Int = (dw-1024)/2
Local cy:Int = (dh-768)/2

Graphics dw,dh,32
SetClsColor 100,100,100
SetViewport cx,cy,1024,768

SetOrigin cx,cy
Cls
DrawText "screen centered",0,0

Flip()
WaitKey()



Last edited 2011


Oddball(Posted 2011) [#6]
Check out my Odd2D module which has aspect correction with several modes and you can also set the border colour. It's listed in my sig, but here are the relevant links in case you have sigs turned off.

Discussion thread
Direct download

Enjoy.


Arabia(Posted 2011) [#7]
Thanks Oddball, will have a look in the morning.


Arabia(Posted 2011) [#8]
Thanks also Jesse. I have heard about SetViewPort and the caution about using it - I think I'll avoid it for now :)


Czar Flavius(Posted 2011) [#9]
I generate a list of detected screen resolutions, and allow a player to choose one (above a minimum, naturally), rather than mandate a specific resolution. If you are using a fixed backdrop, then that is more tricky. My main menu uses a fixed 1024x768 backdrop and it is (at the moment) fixed at 1024x768, but when you enter the game it jumps into full-screen of the desired resolution.

One solution is to pad the sides of your backdrop with extra decorative image and centre it. Widescreen monitors will get to see the extra padding, but the main image won't appear stretched. Normal monitors will strech the image so that the padding is drawn off the edge of the screen, and the main image won't appear squashed.

I hope the suggestion makes sense for you.

Last edited 2011


Arabia(Posted 2011) [#10]
Yep, makes perfect sense Czar. I will have a look at the module that Oddball has posted and if I can't get my head around it then what you are suggesting is my next option.