XNA Creators Club Online
Page 1 of 1 (7 items)
Sort Posts: Previous Next

Confused by scale and screen resolution

Last post 05/11/2009 5:46 PM by David Hunt. 6 replies.
  • 05/11/2009 5:23 AM

    Confused by scale and screen resolution

    So far, I've only been working with text and it looks good. But now I'm in the process of adding controller button images and a controller diagram. This is where things are getting ugly. I've been positioning elements inside the TitleSafeArea and stick to either edges or the very center of the screen (with an offset horizontally or vertically) because I'm afraid to absolute-position anything. My HDTV only supports up to 1280x720 and I don't know how absolute positioning will look on higher or lower resolutions. Am I doing the right thing here, or should I take another approach? Frankly, the amount of calculations being done to position my elements is a little frightening. Something tells me I'm doing it wrong.

    My second problem is that my images are all stretched. For example, with my controller diagram, I'm drawing it at full scale, but it appears slightly stretched horizontally (or compressed vertically, I can't tell). Is this just a side-effect of my screen resolution? Regular Xbox games don't appear to have this problem. In addition, I'm concerned about how my images will appear on higher or lower resolutions. I don't want my controller diagram to fill the entire screen on normal TVs, but I don't want it to look incredibly small on HDTVs (or incredibly low resolution by scaling it up).

    Any tips, tricks, advice? Thanks!
  • 05/11/2009 7:48 AM In reply to

    Re: Confused by scale and screen resolution

    David A Brown:
    I don't know how absolute positioning will look on higher or lower resolutions.
    Develop for 1280x720, and the Xbox will handle any other resolutions. Whether you support other resolutions or not on Windows is your problem, but the solution on Xbox is just to use 1280x720. (Though making sure you're within the SafeArea is a good idea if you plan to get your game on Indie Games)
  • 05/11/2009 11:42 AM In reply to

    Re: Confused by scale and screen resolution

    Hi David,

    if you see your images distorted there is only one explanation: you are not setting properly the PreferredBackBuffer while managing the presentation.

    The best practice is to ser the preferred backbuffer to 720p (1280x720) and prepare all your images for 720p. The Xbox will add black bands on SDTV presenting your game in a letterbox format, which is ok if you don't have too small objects.

    If your game has issues with letterboxing then you have to prepare a double set of graphics: 720p and 600p (800x600) which are the common representation for 16:9 and 4:3 aspect ratios. You'll need also to take that into account in your code. You need to detect at the startup if the device vertical resolution il less than 720: in that case you set your preferred backbuffer to 800x600, else you set it to 1280x720, leaving the rest to the Xbox.

    Cheers,
    Pino
    My game * Astro Match3 * Second update in Playtest now!
    Forum XNA Italia - Linkedin - Twitter (Rarely) - Facebook
    Web XNA Italia - email contact - Messenger: g_defrancesco AT hotmail DOT com
  • 05/11/2009 4:14 PM In reply to

    Re: Confused by scale and screen resolution

    Thank you both for your help. I wasn't aware that XNA would display in letterbox on smaller screens. That definitely sounds helpful. Although, I was hoping to make the game look as good as possible at 1080p instead of scaling everything up from 720p. But I guess I can live without it, since I don't have a 1080p TV to test it with anyway.

    As for the images, I'm running strictly on the Xbox 360, so I'm not setting the PreferredBackBuffer properties (I assume the Xbox automatically handles this). My debug info is showing that the game is indeed running at the correct resolution (1280x720 on a 720p HDTV), yet my images are disproportionate. Which I find strange, because I haven't done any scaling whatsoever.
  • 05/11/2009 4:21 PM In reply to

    Re: Confused by scale and screen resolution

    Answer
    Reply Quote
    David A Brown:
    As for the images, I'm running strictly on the Xbox 360, so I'm not setting the PreferredBackBuffer properties (I assume the Xbox automatically handles this). My debug info is showing that the game is indeed running at the correct resolution (1280x720 on a 720p HDTV), yet my images are disproportionate. Which I find strange, because I haven't done any scaling whatsoever.

    You still have to set the preferred backbuffer properties. The Xbox handles scaling that to the user's selected output resolution, but you still have to tell it what size backbuffer to use. The default is 800x600 if you don't specify one yourself.
  • 05/11/2009 5:27 PM In reply to

    Re: Confused by scale and screen resolution

    David Hunt:

    You still have to set the preferred backbuffer properties. The Xbox handles scaling that to the user's selected output resolution, but you still have to tell it what size backbuffer to use. The default is 800x600 if you don't specify one yourself.

    Ah, I see! The back buffer is independent of the actual screen resolution, then. Setting it to 720p fixed everything. Thanks!
  • 05/11/2009 5:46 PM In reply to

    Re: Confused by scale and screen resolution

    You're very welcome!
Page 1 of 1 (7 items) Previous Next