Detect/Set Screen Resolution (& Full Screen)

I found this good little bit of code on Ziggyware that will both detect maximum screen resolution (given a list of possible screen resolutions & whether or not to run full screen) and switch the screen to that resolution ( and full screen, if enabled).

It can be found here.

Just a note, you probably want to have the resolution checks/changing in the DmaGame initialization before the DmaGame stores the width and height.

Also to add screen resolutions, where you put in:

  1.  
  2.  
  3. if (!InitGraphicsMode(1280, 720, true))
  4. {
  5.   if (!InitGraphicsMode(1024, 768, true))
  6.   {
  7.     if (!InitGraphicsMode(800, 600, true))
  8.     {
  9.       if (!InitGraphicsMode(640, 480, true))
  10.       {
  11.         this.Exit();
  12.       }
  13.     }
  14.   }
  15. }

add your own resolutions to the list.

Post a Comment

Your email is never published nor shared. Required fields are marked *

*
*