TexelOne Posted August 25, 2010 Share Posted August 25, 2010 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! Quote Press any key to continue... Link to comment Share on other sites More sharing options...
ArBuZ Posted August 25, 2010 Share Posted August 25, 2010 this should help: http://msdn.microsoft.com/en-us/library/dd162611%28VS.85%29.aspx [edit] and this one : http://msdn.microsoft.com/en-us/library/ms812499.aspx Quote Q6600@2.4GHz - 9600GT - 4GB DDR2@800MHz - Windows7 x64 3ds max / photoshop CS3 / C++ http://www.arbuznikov.com Link to comment Share on other sites More sharing options...
TexelOne Posted August 25, 2010 Author Share Posted August 25, 2010 Thanks ArBuz, I'll give it a try. Quote Press any key to continue... Link to comment Share on other sites More sharing options...
ArBuZ Posted August 25, 2010 Share Posted August 25, 2010 At home I have a code that makes exactly what you want. I can post it when I get home if you need it. Quote Q6600@2.4GHz - 9600GT - 4GB DDR2@800MHz - Windows7 x64 3ds max / photoshop CS3 / C++ http://www.arbuznikov.com Link to comment Share on other sites More sharing options...
TexelOne Posted August 25, 2010 Author Share Posted August 25, 2010 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! Quote Press any key to continue... Link to comment Share on other sites More sharing options...
Josh Posted August 25, 2010 Share Posted August 25, 2010 There is an undocumented command: GraphicsModeExists:Int(width:Int,height:Int,depth:Int,hertz:Int) Quote My job is to make tools you love, with the features you want, and performance you can't live without. Link to comment Share on other sites More sharing options...
Masterxilo Posted August 25, 2010 Share Posted August 25, 2010 That wouldn't exactly do what he wants. Quote Hurricane-Eye Entertainment - Site, blog. Link to comment Share on other sites More sharing options...
Canardia Posted August 25, 2010 Share Posted August 25, 2010 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. Quote ■ Ryzen 9 ■ RX 6800M ■ 16GB ■ XF8 ■ Windows 11 ■ ■ Ultra ■ LE 2.5 ■ 3DWS 5.6 ■ Reaper ■ C/C++ ■ C# ■ Fortran 2008 ■ Story ■ ■ Homepage: https://canardia.com ■ Link to comment Share on other sites More sharing options...
cocopino Posted August 25, 2010 Share Posted August 25, 2010 looping width 640 to 2000 and height 480 to 1200 takes 1.3 seconds on my laptop in blitzmax so that should be doable. Quote desktop: Quad core Q6600 + 4GB + ATI HD4890 + XP laptop: Dual core T6400 + 4 GB + NVidia 9600M GT + Vista 32 Link to comment Share on other sites More sharing options...
TexelOne Posted August 25, 2010 Author Share Posted August 25, 2010 Thanks Josh, That is actually what I need ! 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 Quote Press any key to continue... Link to comment Share on other sites More sharing options...
Mumbles Posted August 26, 2010 Share Posted August 26, 2010 * 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...) Quote LE Version: 2.50 (Eventually) Link to comment Share on other sites More sharing options...
TexelOne Posted August 26, 2010 Author Share Posted August 26, 2010 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 . Quote Press any key to continue... Link to comment Share on other sites More sharing options...
Masterxilo Posted August 26, 2010 Share Posted August 26, 2010 It is a very bad idea to limit supported resolutions. It's so sad that many old games only support a limited amount of resolutions. But modern games should (and all I know do) support every resolution the user's system supports (no matter what resolutions are possible in like 10 years). 1 Quote Hurricane-Eye Entertainment - Site, blog. Link to comment Share on other sites More sharing options...
Canardia Posted August 26, 2010 Share Posted August 26, 2010 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. Quote ■ Ryzen 9 ■ RX 6800M ■ 16GB ■ XF8 ■ Windows 11 ■ ■ Ultra ■ LE 2.5 ■ 3DWS 5.6 ■ Reaper ■ C/C++ ■ C# ■ Fortran 2008 ■ Story ■ ■ Homepage: https://canardia.com ■ Link to comment Share on other sites More sharing options...
TexelOne Posted August 28, 2010 Author Share Posted August 28, 2010 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! Quote Press any key to continue... Link to comment Share on other sites More sharing options...
Masterxilo Posted August 28, 2010 Share Posted August 28, 2010 I guess it checks the display modes available on the current system, that is, display and graphics card modes combined. Quote Hurricane-Eye Entertainment - Site, blog. Link to comment Share on other sites More sharing options...
Mumbles Posted August 29, 2010 Share Posted August 29, 2010 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. Quote LE Version: 2.50 (Eventually) Link to comment Share on other sites More sharing options...
Chiblue Posted August 31, 2010 Share Posted August 31, 2010 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... Quote If it's not Tactical realism then you are just playing.. Link to comment Share on other sites More sharing options...
TexelOne Posted September 3, 2010 Author Share Posted September 3, 2010 @Mumbles I'm just calling the function directly and it works fine: if (GraphicsModeExists(scrW, scrH, scrD, scrZ)) { //...do something! } Quote Press any key to continue... Link to comment Share on other sites More sharing options...
Canardia Posted September 3, 2010 Share Posted September 3, 2010 @Mumbles: GraphicsModeExists() was added in 2.32. Quote ■ Ryzen 9 ■ RX 6800M ■ 16GB ■ XF8 ■ Windows 11 ■ ■ Ultra ■ LE 2.5 ■ 3DWS 5.6 ■ Reaper ■ C/C++ ■ C# ■ Fortran 2008 ■ Story ■ ■ Homepage: https://canardia.com ■ Link to comment Share on other sites More sharing options...
Mumbles Posted September 4, 2010 Share Posted September 4, 2010 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? Quote LE Version: 2.50 (Eventually) Link to comment Share on other sites More sharing options...
Recommended Posts
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.