List of supported resolutions

This forum is currently in read-only mode.
0 favourites
From the Asset Store
Adjusting the game screen for different resolutions (Letterbox scale)
  • Hey, just wondering how I can get what resolutions a users computer can do. I know you can get their desktop resolution, but I'd like to know of lower resolutions too.

    For instance, in many (most) games when you go to the video options they'll have a drop down list of the resolutions your computer can support. And I'd like to make a similar thing.

    Or do they just list any resolution thats not larger than your desktop resolution?

  • No they don't list just any. They query the system, which reports any resolutions, that the attached monitor reports.

    There is no built-in support for that query, or I haven't found it. I'm sure, ROJO knows how to access these informations directly from the system using Python ;)

    However, using Python you can also get such a list if you install PyGame. The function "pygame.display.list_modes" does exactly what you want.

    It would be used like so:

    import pygame.display

    pygame.display.init()

    modelist = pygame.display.list_modes(32)

    32 indicates that you are looking for resolutions with 32bit color. The result is a list with tuples:

    [(640, 480), (1024, 768), (1440, 900), etc...]

    [EDIT] Link to the pygame function description: http://www.pygame.org/docs/ref/display.html#pygame.display.list_modes

  • Thanks a lot tulamide! I really don't understand python much (only using it to change cursor in my game so far). Not sure how to get that pygame thing. Do I make a directory for it like I have with ctypes and do the "sys.path.append(System.AppPath + 'data')" at the start of the script? How would I access the list its made ("modelist = pygame.display.list_modes(32)") with events?

  • Well, contrary to what tulamide says, I don't know how how to do it, but I just learned from a few internet serches and about an hour of tinkering.

    Here is the example with the required pywin32 files.

    I also included the cursor example edited to use pywin32 instead of ctypes to reduce the amount of files needed.

    http://dl.dropbox.com/u/5426011/examples6/resolutions.zip

    In my example I used the name "resolutions" instead of "modelist" but they will act the same.

    To access the first mode:

    modelist[0]

    the second mode, and so on.

    modelist[1]

    modelist[2]

    To access the width of say the first mode do this:

    modelist[0][0]

    and the height:

    modelist[0][1]

  • Wow, that's fantastic! Thanks for your time R0J0.

  • Do you ever get the feeling that R0J0hound's real name may be Zod, and we should all 'bow down before' him :)

    Joke aside (if that's what you'd call it), very useful .cap, much obliged.

    zen

  • Thanks, very helpful.

  • Just in case anyone else uses this: it's best to change the range(200) to a higher value so that it shows more high resolutions, my 1600x1200 didn't show up in that range.

  • range(200) was purely arbitrary, my system had about 95 modes.

    I fixed the cap so that it will read all the modes.

    http://dl.dropbox.com/u/5426011/examples6/resolutions.cap

  • How does it work exactly? What are all these modes? On one comp I have 3 modes for each resolution on another about 6. I thought, there'd be just one mode(32bit) for each resolution.

  • Ok, fixed it so that modes are not repeated. The other modes were rotated modes and modes with different refresh rates.

    On my computer only these modes are now listed:

    320 200

    320 240

    400 300

    512 384

    640 400

    640 480

    800 600

    1024 768

    1280 768

    1280 800

  • Awesome, thanks again!

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Well, contrary to what tulamide says, I don't know how how to do it, but I just learned from a few internet serches and about an hour of tinkering.So, despite of what you said, in the end you proved me right <img src="smileys/smiley4.gif" border="0" align="middle" />

    I just can't think of anything in programming that you couldn't solve with such an ease and clear, comprehensive concept. It is pure admiration. For example, I too started an internet search but I didn't come up with anything but pygame. If anything fails, you are reliable. That was needed to be said <img src="smileys/smiley1.gif" border="0" align="middle" />

  • Perfect, thanku.

  • Does this also support 64bit Operating Systems? I got an error saying something about no 'win32api'.

    Old thread I know, but contains some very useful information.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)