Sign in to follow this  

Full screen without changing resolution in games

This topic is 2098 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hey,
I'd like to create a game with a full screen window but without changing system resolutions and I would like to keep the buttons on the menu bar. But I'm not quite sure how to display graphic etc when creating a program on full screen. Every computer has different resolutions so things might display differently on my computer and on others. Something might not suit the current resolution and might be cut...
I thought that I could store my resolutions in a variable and multiply object's coordinations, scale its width and height by the ratio: current system resolution/original resolution?
I would be very grateful for help!

Share this post


Link to post
Share on other sites
btw I'm using winapi to create a window and DirectX to handle graphic...
bump

Share this post


Link to post
Share on other sites
Direct3D9 [url="http://msdn.microsoft.com/en-us/library/bb174314(v=vs.85).aspx"]EnumAdapterModes[/url] allows you to collect various informations about the screen. [url="http://msdn.microsoft.com/en-us/library/bb174316(v=vs.85).aspx"]GetAdapterDisplayMode [/url]will retrieve the current screen resolution.
There are also a few WinAPI functions, but I cannot remember their names right now.

Share this post


Link to post
Share on other sites
You need to adapt your game to arbitrary (but not too small) screen sizes: you can use the same techniques as "liquid" web page layouts. Graphical elements can be stretched in either or both directions, repeated, padded with some kind of filler, replaced by larger or smaller counterparts.
At worst, centering the standard size layout in the screen and drawing an empty border around it is a simple and universal technique

Share this post


Link to post
Share on other sites
You can get the resolution through the Windows api with [url="http://msdn.microsoft.com/en-us/library/windows/desktop/ms724385(v=vs.85).aspx"]GetSystemMetrics[/url]:
[code]
int width = GetSystemMetrics(SM_CXSCREEN);
int height = GetSystemMetrics(SM_CYSCREEN);
[/code]

[quote]I would like to keep the buttons on the menu bar[/quote]

If you mean you want the title bar with minimize / maximize / close buttons, you wouldn't be using a full screen window (at least in game dev talk). Fullscreen usually means Dx has exclusive control of the screen. What it sounds like you want is a windowed application running in a maximized window.

When you create a window with CreateWindowEx, pass in [code]WS_OVERLAPPEDWINDOW | WS_MAXIMIZE[/code]
That should give you a maximized window with a title bar.

As for differences in resolutions:

For resolutions with the same aspect ratio, if you use the same projection matrix, the resulting frames will be scaled versions of each other - they will both show the same thing just be stretched. Different aspect ratios can give you some trouble though, because with two different aspect ratios, one window has to show less than the other. You can make it so that both show the same amount vertically, thus a widescreen aspect ratio would show more on the sides; you can make it so that both show the same amount horizontally, thus a non-widescreen aspect ratio would show more on the top and bottom.

Share this post


Link to post
Share on other sites
thanks for replies. Btw wouldn't it be better if I saved screen x and y, that I was working on, in variables and display every graphic elelment multiplying its x position and width by current screen x/my screen x(in which the program was created) and the same way with height and position y?

Share this post


Link to post
Share on other sites
Doh just realized you were talking about 2d, my previous comments on resolution were about 3d.

What you are talking about is relative positioning, where each element's position is 0 - 1.0. You then multiply its relative position by the screen width or height to get the absolute position. That will give you an effect of stretching or compressing the original image, which would be good enough for a basic ui. You would still need to modify the layout for different aspect ratios though.

Share this post


Link to post
Share on other sites
thanks, so I understood the relative and absolute position but what about width and height of the element? It should be scaled, right? By what amount?

Share this post


Link to post
Share on other sites
Sign in to follow this