Resolution Scaling

This forum is currently in read-only mode.
From the Asset Store
Adjusting the game screen for different resolutions (Letterbox scale)
  • Okay, I've been trying this out for a while, and am still not sure how to go about it, or if it is impossible to do in Construct.

    I'm designing a game at 16:10 widescreen resolution, 1440 x 900. The game runs in full-screen. Obviously, on a 16:10 monitor, it displays on the full screen, and what I'd like to happen is, on dfferent resolutions (16:9, 4:3), for the game to run in 16:10 resolution with black bars at the top and bottom, so none of the objects are stretched. This currently doesn't seem possible to do.

    At the moment, if I try and run an app with a native 16:10 resolution in fullscreen on a non-16:10 monitor, it doesn't even open, citing a DirectX issue. I can make the app in 4:3 resolution, and it will open on widescreen monitors, but the display is stretched. I hate it when games do that

    Does anyone have any idea how I can make this work? Is it achievable with layer zooming, and if so, how, as I've had no luck using this method so far.

    Many thanks,

    • Tom
  • you might be able to use the window object to scale the display.

  • I think I've cracked it! I've made an app that displays correctly on all the monitors in my house anyway. Test it out, let me know if it looks right on your monitors:

    http://www.mediafire.com/file/tnmykyzml1y/Scaler.cap

    Basically, it should display in widescreen, 16:9 format, with black bars at the top and bottom if your display is not 16:9. The circle should be round, the square square, and Samus should be pretty much in the middle. There should be corner markers right at each corner of the display.

    It works using the Window Object to resize the display to match the size of your monitor, then zooming the layer using the coefficient [monitor width]/[native app resolution], to scale everything to the new window size. Then it kicks the app into fullscreen mode.

    My thanks go to Davioware for introducing me to the Window object, as well as AshyRaccoon for pointing out the SysInfo object and Mipey for coming up with the required scaling coefficient (it's been a long, long time since I had to do any real maths, it would've taken me a while to work out by myself).

    Let me know if this works for everybody. If it does, I'll make a better example .cap and write up a proper tutorial on how to do it, as this is a useful technique for those looking to make HD games in Construct.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • ... I did what?

  • You're welcome.

    I think it looks okay.. but sometimes I don't notice display stretching much when it's present.

    1680x1050 widescreen here. 16:10. I got black bars at the top and bottom, and the corner markers at the corners of the visible area.

    Not related to the uploaded cap:

    I messed around with altering layer zooming and placing black bars, but it's odd. Setting the layer zoom isn't working right unless I press Z twice.

    That is, my event is:

    MouseKeyboard: On key Z pressed

    System Change display size to 640 x 480

    Set Layer "Layer 1" zoom ratio to (640/1440 * 100, 480/900 * 100)

    or even if I replace that set layer zoom ratio with

    Set Layer "Layer 1" zoom ratio to (44, 53)

    I have to press Z twice.

    The first time, it becomes 70.3125, 70.3215.

    I have an event afterward telling me what the zoom is:

    System: Always (every tick)

    Text Set text to "" & DisplayWidth & "x" & DisplayHeight & ", Zoom: " & LayerZoomX("Layer 1") & "x" & LayerZoomY("Layer 1")

    I used 1440x900 so I could test the zoom in windowed mode.

    *shrugs*

  • ... I did what?

    You, my friend, wrote this thread:

    I nicked your example of using OriginalHeight'*(DisplayHeight/'DefaultHeight') to zoom the layers to the right amount. Would've taken me a while to work out for myself.

    I'm currently trying to make it work with scrolling. It's...interesting. I might've done it now, needs testing on other monitors first though.

  • Oh, totally forgot about that thread! Well, in that case you are welcome!

  • I'm having trouble with positioning the black bars when trying to enable scrolling. My initial solution was to simply put the black bars on a different layer and set the scroll ratio to zero, so the bars don't scroll when the other layers do. Trouble with this is, that screws up the positioning of the bars relative to other layers, and I can't seem to reposition them.

    Is there a way to reposition a layer, without changing the scroll ratio? I've also tried repositioning the bars at runtime using equations, but my math is completely wrong. I made it work fine on my monitor, but trying it on one with an even slightly different ratio and it screws up completely.

    UPDATE: I've kind of got it working by repositioning the bars according to the dimensions of the screen. The trouble is, you can't see objects at the very edges of the screen when you are not playing on a 16:9 monitor using this solution. Have a look anyway:

    http://www.mediafire.com/file/wtlxlznqu ... Scroll.cap

    Also, I'm not sure if there's a way to stop the bars 'jittering' when the character moves, it's as if the 'Always' event isn't repositioning them fast enough.

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