Resolution check?
BlitzMax Forums/BlitzMax Programming/Resolution check?
| ||
Hi! Another quick question from Robby! I really appreciate the help I'm getting on these boards and my project is coming along very nicely as a direct result of the advice I've been getting here - thank you! This is probably easy, but I can't find docs on it. How do I read what resolutions a particular Windows or Mac screen is able to support, to insure that my game checks for it before attempting to change the resolution? Is the code different on Mac and Windows as I'm planning on both? Thanks yet again, -Robert |
| ||
http://www.blitzbasic.com/bmdocs/command.php?name=GraphicsModes&ref=2d_cat Just take note that this will take info from the display drivers. If the user has bad/generic drivers, you could still end up getting resolutions reported that your hardware does not actually support. |
| ||
Thanks for the tip! I ran this and had some of my friends run it, and it seems to work fine. I think I know how I can do this. My game was made in 1280x800, then I realized there's a lot of 16:9's out there - 1280x720. So I redrew some panels, and just need to make sure it sets to the correct screen size and handles both. But some screens have both 800 and 720, regardless of the monitor's aspect ratio, and either add black bars top and bottom, or squeeze the 800 to 720. Do you think this solution would work: (In "pseudo paraphrase" code!) 1) Res checker code seems to list highest res as last on list. 2) Is it safe to assume that num is the native res of the display? 3) Compare that to a list of common res's. 4) Double-check that either 1280x800 or 1280x720 exists. 5) If highest res is on the 16:9 list and 1280x720 exists, use that. 6) If highest res is on the 16:10 list and 1280x800 exists, use that. My goal is to make sure it will fill the screen on any widescreen, without black lines or squeezing, etc. Not too worried about square screens just yet. My check list is this: 16:9's 1280x720 1360x768 1366x768 (a weird approx of 16:9, but getting common) 1600x900 1920x1080 2560x1440 16:10's 1280x800 1440x900 1600x1024 1680x1050 1920x1200 2560x1600 Do you think I have my bases covered here? Thanks! -Robert |
| ||
Can't figure this out. If I run the For mode:TGraphicsMode=EachIn GraphicsModes() sample you linked by itself in a little program, it works fine. If I put it in a function, I get "Identifier "mode" not found. If I put it at the top of my program, same thing. Any idea what's up? |
| ||
Never mind. I forgot I had to define it: Local mode:TGraphicsMode :) |
| ||
Or, you can combine both together:For Local mode:TGraphicsMode = EachIn GraphicsMode() . . . Next It is also a lot safer to do it this way, since the variable 'mode' will 'expire' after the For/Next loop is finished. It may also be faster in many situations. Also, you should consider using Strict or SuperStrict if you aren't all ready. Happy Coding, Russell Jones |