Jump to content

Supported display resolutions


TexelOne
 Share

Recommended Posts

Hi,

 

I want to make an options menu for a game, where the player would be able to change the display resolution among other things. I can get the desktop resolution using GetSystemmetrics() and also determine if the display is standard or widescreen by dividing width / height, but now I need the menu to display a list of only the supported display resolutions of the computer where its running at.

 

Is there a way of getting such list?

 

Thanks in advance!

Press any key to continue...

Link to comment
Share on other sites

Hi ArBuZ,

 

I thought maybe LE had a function that did that (like Unity's Screen.resolutions) and I was trying to reinvent the wheel, but the Win32 EnumDisplaySettings function looks good. I haven´t had time to try it yet but as soon as I can I'll post results.

 

I would appreciate it if you could paste your code!

 

Thanks again!

Press any key to continue...

Link to comment
Share on other sites

If it works fast, you could do a quick loop for all possible x and y values and call that function, and record all positive results in a vector.

Ryzen 9 RX 6800M ■ 16GB XF8 Windows 11 ■
Ultra ■ LE 2.53DWS 5.6  Reaper ■ C/C++ C# ■ Fortran 2008 ■ Story ■
■ Homepage: https://canardia.com ■

Link to comment
Share on other sites

Thanks Josh,

 

That is actually what I need :D! As Lumooja sugested I can do a quick loop, since I would just be checking the 5 or 6 most common resolutions depending on the display's aspect.

 

These are the resolutions I would populate the available resolutions list from:

Standard

* 1024x768 (4:3)

* 1152x864 (4:3)

* 1280x960 (4:3)

* 1280x1024 (5:4)

* 1400x1050 (4:3)

 

Widescreen

* 1152x720 (16:10)

* 1280x720 (16:9)

* 1280x800 (16:10)

* 1440x900 (16:10)

* 1600x900 (16:9)

* 1680x1050 (16:10)

 

Thanks everyone for your responses ;)

Press any key to continue...

Link to comment
Share on other sites

* 1280x980 (4:3

 

Don't know how you're doing it, but that should be 1280x960.

If you're doing all values between say 480 and 1050, it will be fine.

If you're just trying specific numbers, say: 480, 800, 768, 864, 980, 1024 etc. Then that res will usually fail in fullscreen mode.

 

Also would people not think that 1920x1080 was common?

And the 16:10 equivalent of 1920x1200? (I prefer 16:10 over 16:9 any day...)

LE Version: 2.50 (Eventually)

Link to comment
Share on other sites

that should be 1280x960.

Yes, I ment 1280x960 (fixed - darn typos!).

 

You're right about 1080p. It seemed like overkill to go Full HD or higher, but from 1050 to 1080 there's really not much difference, so I'll add 1440x1080 (4:3), 1920x1080 (16:9) and 1920x1200 (16:10) to the list :lol:.

Press any key to continue...

Link to comment
Share on other sites

You should support also the desktop resolution for fullscreen.

 

And you should also have a list of windowed and fullscreen resolutions, they are different because in windowed mode you can choose a resolution which fits your design best, like anamorphic widescreen for example, but in fullscreen mode you are limited to what the monitor can do.

 

My monitor is kinda wierd since it can't display sub-resolution widescreen formats, although it is a 16:10 widescreen monitor, but it only supports 4:3 sub-resolution fullscreen modes.

 

And if you want to be really professional, you should also have a seperate screen and window resolution for fullscreen modes. For example in fullscreen mode you want maximum screen resolution, but a smaller window resolution because the GPU can't handle FullHD with decent FPS.

Ryzen 9 RX 6800M ■ 16GB XF8 Windows 11 ■
Ultra ■ LE 2.53DWS 5.6  Reaper ■ C/C++ C# ■ Fortran 2008 ■ Story ■
■ Homepage: https://canardia.com ■

Link to comment
Share on other sites

You should support also the desktop resolution for fullscreen.

Yes, desktop resolution will be automatically added to the array (if its not already in it). The game will only run fullscreen.

 

 

you should also have a seperate screen and window resolution for fullscreen modes

What would the difference be to calling Graphics() with a lower resolution in fullscreen mode? Wouldn't it just scale the the pixels in the window screen resolution to fit the screen resolution?

 

 

...the GPU can't handle FullHD with decent FPS.

That was my initial concern and why I had not gone up to Full HD from the start, but I guess in the end it all depends on the player's GPU/display combo and that's where being able to select a lower resolution helps in getting better speed.

 

 

@Josh:

GraphicsModeExists() checks for supported resolutions on the GPU or the display?

 

Thanks again!

Press any key to continue...

Link to comment
Share on other sites

This undocumented command. Is it in the DLL or just a command that the source / BlitzMax users can use?

I ask because, it's not in my engine.h file, so I tried:

 

//Explicit DLL linking for the hidden command
typedef int (_stdcall *TGraphicsModeExists) (int width, int height, int depth, int hertz);
TGraphicsModeExists GraphicsModeExists;

int main( int argn, char* argv[] )
{
Initialize();
HINSTANCE hInstLibrary = LoadLibraryA((LPCSTR)"engine.dll");
if(hInstLibrary)
{
	GraphicsModeExists = (TGraphicsModeExists)GetProcAddress(hInstLibrary, "GraphicsModeExists");
	if(!GraphicsModeExists)
	{
		std::cout << "Function pointer is null\n";
		Terminate();
		return 0;
	}
}
else
{
	std:cout << "Failed to load the DLL explicitly...\n";
	Terminate();
	return 0;
}
//Remainder of the code body

 

Result:

Function pointer is null.

LE Version: 2.50 (Eventually)

Link to comment
Share on other sites

Dark GDK has a command to return a list of all supported graphics resolutions for each graphics card that is available within the system. If Dark GDK can do it I cannot beliebe it is that difficult?

 

dbPerformChecklistForDisplayModes

 

and

 

dbPerformChecklistForGraphicsCards

 

these are very useful to ensure your users cannot select a mode that is not valid...

If it's not Tactical realism then you are just playing..

Link to comment
Share on other sites

When Josh said "undocumented" I presumed he just meant there was no wiki entry for it, and that otherwise, it was there from the start - so yes I was surprised when I couldn't call it directly. And then, when GetProcAddress couldn't find it, I was thinking it may have been a 2.3 thing. Oh well, never mind, eh?

LE Version: 2.50 (Eventually)

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...