Full screen without changing resolution in games

Started by
6 comments, last by savail 12 years ago
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!
Advertisement
btw I'm using winapi to create a window and DirectX to handle graphic...
bump
Direct3D9 EnumAdapterModes allows you to collect various informations about the screen. GetAdapterDisplayMode will retrieve the current screen resolution.
There are also a few WinAPI functions, but I cannot remember their names right now.

Previously "Krohm"

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

Omae Wa Mou Shindeiru

You can get the resolution through the Windows api with GetSystemMetrics:

int width = GetSystemMetrics(SM_CXSCREEN);
int height = GetSystemMetrics(SM_CYSCREEN);


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 WS_OVERLAPPEDWINDOW | WS_MAXIMIZE
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.
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?
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.
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?

This topic is closed to new replies.

Advertisement