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

Get help using Construct 2

Post » Wed Dec 30, 2015 5:52 am

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!
B
41
S
12
G
14
Posts: 1,122
Reputation: 11,268

Post » Wed Dec 30, 2015 5:06 pm

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?
B
41
S
12
G
14
Posts: 1,122
Reputation: 11,268

Post » Fri Jan 01, 2016 5:38 pm

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?
B
41
S
12
G
14
Posts: 1,122
Reputation: 11,268

Post » Fri Jan 01, 2016 6:37 pm

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 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 » Fri Jan 01, 2016 10:01 pm

LittleStain wrote: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
B
41
S
12
G
14
Posts: 1,122
Reputation: 11,268

Post » Sat Jan 02, 2016 2:40 am

Ok..

So what do you expect to happen, because what is happening is what is supposed to happen..
The screen is scaled up in a way that the whole original project-size is on screen..
There will be more than just that on the screen, because the aspect ratio of the window, makes the window's content surface bigger than the project..
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 » Sat Jan 02, 2016 10:32 am

LittleStain wrote:Ok..

So what do you expect to happen, because what is happening is what is supposed to happen..
The screen is scaled up in a way that the whole original project-size is on screen..
There will be more than just that on the screen, because the aspect ratio of the window, makes the window's content surface bigger than the project..

@LittleStain Exactly, that's what's great about that scaling mode is that it shows more onscreen. I just want to resize the HUD so it is scaled to the entire width of the window, whilst still retaining more viability for the rest of level to be seen. I'd then unscale it for the other modes.
B
41
S
12
G
14
Posts: 1,122
Reputation: 11,268

Post » Sat Jan 02, 2016 4:32 pm

You could set the width of the hud to viewportleft()-viewportright()?
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 » Sat Jan 02, 2016 5:05 pm

LittleStain wrote:You could set the width of the hud to viewportleft()-viewportright()?

On the scale layer expression, I'm getting a syntax error with that first closed bracked ')', it's missing something?
B
41
S
12
G
14
Posts: 1,122
Reputation: 11,268

Post » Sat Jan 02, 2016 5:13 pm

Zebbi wrote:
LittleStain wrote:You could set the width of the hud to viewportleft()-viewportright()?

On the scale layer expression, I'm getting a syntax error with that first closed bracked ')', it's missing something?


As outlined in the manual - those expressions require a 'Layer' component between the brackets.
If your vision so exceeds your ability, then look to something closer.
Moderator
B
136
S
31
G
86
Posts: 5,490
Reputation: 59,766

PreviousNext

Return to How do I....?

Who is online

Users browsing this forum: No registered users and 20 guests