[CAPX INCLUDED] Scale layer to window size/viewport width?

0 favourites
From the Asset Store
Get Ready for the New Wave of "Bottom Screen" Games!
  • When I change the screen mode to "scale outer", my HUD layer is too small, so I want to scale the layer when that mode is selected. Currently on my 1920x1080 res monitor, a figure of 1.333 works well, but if I try it on, say, an 800x600 screen, the HUD is too wide. Is there a way of getting a dynamic scale amount depending on the resolution of the players monitor when I select scale outer? I would have thought ViewportRight would have been useful, but I can't use that in a scale layer expression.

    hud capx: https://www.dropbox.com/s/g4curnknsl789 ... .capx?dl=0

    CAPX: https://www.dropbox.com/s/4kdl077zi0pro ... .capx?dl=0

  • So, I guess the best question is how do I calculate the scale size based upon the current size of the window when using scale outer mode?

  • You might want to try the anchor behaviour on a layer with 0,0 paralax to keep things in place..

  • You might want to try the anchor behaviour on a layer with 0,0 paralax to keep things in place..

    I've got the anchor on the HUD to keep it in the right place, but the problem is it's not wide enough when the screen is scaled so I need to resize the layer when the scaling is on. I just need to calculate the correct width to scale it depending on the monitor size of the user. With a 1920x1080 resolution monitor, a figure of 1.333 works to get the width right, but it's too wide on a 4:3 display, so I need to calculate the right aspect for the scaling.

  • Updated the topic title to give a better idea of what I'm trying to do.

  • I know my post wont help a lot, but what I did was stick to Letterbox scale and just let the players handle black bars on sides.

    If nothing else works I would say go with this, especially if for desktop computers, as black bars are more fogiving there than on mobile.

  • I know my post wont help a lot, but what I did was stick to Letterbox scale and just let the players handle black bars on sides.

    If nothing else works I would say go with this, especially if for desktop computers, as black bars are more fogiving there than on mobile.

    Yeah, I'm not working with mobile, which is why I have a switch to allow the player to change the scaling mode to whatever they please, rather like tools like Dosbox and ScummVM allow, for instance. I just need to be able to calculate the window width for the users screen to use as a size for the layer scale, to keep the HUD the full width of the window in "scale outer".

  • I find it very strange that something wouldn't fit on the screen when using scale outer, because that mode was made to scale in a way that everything in the original window is on screen..

    If you use crop instead of any of the other scaling modes and scale it yourself it's pretty easy to do..

    At least I've never had issues..

  • (...) rather like tools like Dosbox and ScummVM allow, for instance (...)

    ScummVM? Sorry to go off topic a bit but are you designing a point and click adventure game in CS2?

  • >

    > (...) rather like tools like Dosbox and ScummVM allow, for instance (...)

    >

    ScummVM? Sorry to go off topic a bit but are you designing a point and click adventure game in CS2?

    I wish! Maybe c3 will add some good tools for this!

  • So, if I'm running a monitor size of 1920x1080, what calculation would return a size of 1.333? Could I divide the window width by something? Just any sort of number I could use to get the layer to scale correctly on all aspect ratios!

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Okay, I've got a window size of 640x480 (don't laugh) which scales the HUD layer up correctly to 1920x1080 with a figure of 1.333. So, how can I calculate the window size with scale outer mode for other aspect ratios?

  • Here's an example capx: https://www.dropbox.com/s/4kdl077zi0pro ... .capx?dl=0 - press 'S' to scroll through the scale modes, and notice on the scale outer mode, the width of the blue bar is too shy? I need to scale that to the right width when the scale setting is used. So, how do I get the game to calculate the correct viewport scale amount?

  • I don't think many people will be able to open that project and help you, because you are using so many third-party plugins like Magicam, Pause, Litetween, and Rotation Override..

  • I don't think many people will be able to open that project and help you, because you are using so many third-party plugins like Magicam, Pause, Litetween, and Rotation Override..

    Thanks for pointing that out LittleStain sorry, I tried to get rid of things and forgot about this, here's a new one that will work for everyone: https://www.dropbox.com/s/4kdl077zi0pro ... .capx?dl=0

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