locked
Surface Pro Problems

    Question

  • I have a c++/Direct3D app and a customer emailed me today with the following:

    "Have been loving your app on a Surface RT. Just upgraded to a Surface Pro over the weekend. The game installs, but when I open it, it only fills a small block of the screen."

    I set the Simulator to 1920x1080 and ran my app and sure enough I see the same thing.

    I tracked it back to some code I wrote just before launch that forces the app into landscape mode, since I don't have my engine rigged to handle orientation changes in real-time.

    The offending code related to me needing to know the width and height of the window using this code:

    int width = m_window->Bounds.Width;

    int height = m_windows->Bounds.Height;

    When I have the simulator set to 1920x1080 and I debug my app though the simulator it returns

    width = 1371

    height = 771

    Is there a known problem with windows width/height querying?

    I have Supported Orientations set to "Landscape" only in the app manifest which forces the app into Landscape mode

    I needed to know the width and height because if the user launches in portrait mode at the time the device initializes the app it has not yet swtiched so orientations so I found I had to figure out what the widht and height were so I could init the device context with what the windows was going to be once it was forced into landscape.

    Kind of convoluted, but it works on several PC's of different sizes shapes and orientations, inclding my development Surface RT that I have and I have not heard of any problems until today from my customers.

    When I set the simulator to SurfaceRT resolution width and height are returned correctly as (1366 x 768)


    http://www.puttnutz.com

    Thursday, March 14, 2013 9:02 PM

Answers

  • Hi David,

    This is documented behavior from CoreWindow.Bounds: it retrieves device-independent pixels (DIPs) which take into account the system's magnification settings. Because Surface Pros have high resolution screens they run their UI at 140% DPI.

    As noted in the Bounds docs, you can convert from DIPs to physical pixels by multiplying by DPI/96.

    You can get the logical DPI from DisplayProperties.LogicalDpi.

    --Rob

    • Marked as answer by David_Brooks Friday, March 15, 2013 6:31 AM
    Thursday, March 14, 2013 10:03 PM
    Moderator

All replies

  • Hi David,

    This is documented behavior from CoreWindow.Bounds: it retrieves device-independent pixels (DIPs) which take into account the system's magnification settings. Because Surface Pros have high resolution screens they run their UI at 140% DPI.

    As noted in the Bounds docs, you can convert from DIPs to physical pixels by multiplying by DPI/96.

    You can get the logical DPI from DisplayProperties.LogicalDpi.

    --Rob

    • Marked as answer by David_Brooks Friday, March 15, 2013 6:31 AM
    Thursday, March 14, 2013 10:03 PM
    Moderator
  • Yes, that fixes it.

    In case someone else runs into this problem please note that the mouse/touch event Point locations are also in DIP's so I had to convert those as well.

    I am guessing that the right way to go is to always work in DIP's, but when using Direct3D with back buffers and render targets, etc. I can't help but think in actual pixels.

    I can't believe I am the only developer on the planet who got hit by this.

    I highly recommend using the simulator with Surface Pro resolution and making sure your app works correctly.


    http://www.puttnutz.com

    Friday, March 15, 2013 6:36 AM
  • Hi David,

    I'm glad to hear that working for you now.

    I highly recommend using the simulator with Surface Pro resolution and making sure your app works correctly.

    I heartily agree with this. Especially with more high resolution systems coming it is increasingly important to make sure you test at multiple resolutions. This should also be covered when you test your app for accessibility

    --Rob

    Friday, March 15, 2013 10:52 PM
    Moderator
  • I can't believe I am the only developer on the planet who got hit by this.
    You aren't. Thanks both for the info.
    Wednesday, March 27, 2013 12:13 PM