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

Get help using Construct 2

Post » Tue Dec 29, 2015 2:05 am

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
Last edited by Zebbi on Sun Jan 03, 2016 4:51 pm, edited 6 times in total.
B
39
S
12
G
14
Posts: 1,110
Reputation: 11,184

Post » Tue Dec 29, 2015 3:01 pm

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?
B
39
S
12
G
14
Posts: 1,110
Reputation: 11,184

Post » Tue Dec 29, 2015 4:52 pm

You might want to try the anchor behaviour on a layer with 0,0 paralax to keep things in place..
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Post » Tue Dec 29, 2015 5:23 pm

LittleStain wrote: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.
B
39
S
12
G
14
Posts: 1,110
Reputation: 11,184

Post » Tue Dec 29, 2015 7:57 pm

Updated the topic title to give a better idea of what I'm trying to do.
B
39
S
12
G
14
Posts: 1,110
Reputation: 11,184

Post » Tue Dec 29, 2015 8:05 pm

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.
Brick by brick, stone by stone.
B
50
S
22
G
13
Posts: 273
Reputation: 10,413

Post » Tue Dec 29, 2015 8:13 pm

Solomon wrote: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".
B
39
S
12
G
14
Posts: 1,110
Reputation: 11,184

Post » Tue Dec 29, 2015 8:22 pm

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..
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Post » Tue Dec 29, 2015 8:29 pm

Zebbi wrote:(...) 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? 8-)
Brick by brick, stone by stone.
B
50
S
22
G
13
Posts: 273
Reputation: 10,413

Post » Tue Dec 29, 2015 9:52 pm

Solomon wrote:
Zebbi wrote:(...) 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? 8-)


I wish! Maybe c3 will add some good tools for this! ;)
B
39
S
12
G
14
Posts: 1,110
Reputation: 11,184

Next

Return to How do I....?

Who is online

Users browsing this forum: ladjuric, luckyrawatlucky, lukedevel, m0nkeybusiness, tunepunk and 11 guests