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

Get help using Construct 2

Post » Sun Jan 03, 2016 2:33 pm

Zebbi wrote:
LittleStain wrote:Setting the scale of the layer to such an enormously high number isn't what you are after..
If you set the width of the bar to viewportright()-viewportleft(), however..

Yes, that would work, but I need not just that bar but the other items on the layer resized too, all of the score and life and health numbers. 1.3 isn't enormously high for a layer scale, it's only a third(ish) bigger. Can I scale a whole group of items so they're exactly the same relative size? If not, that's why I wanted to use a dynamic layer scale figure depending on the resolution of the players screen.


Why would you use layer scale?
Everything does get scaled automatically..
You didn't want to scale the bar, you wanted to stretch it, that's the difference..
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 » Sun Jan 03, 2016 3:06 pm

LittleStain wrote:
Zebbi wrote:
LittleStain wrote:Setting the scale of the layer to such an enormously high number isn't what you are after..
If you set the width of the bar to viewportright()-viewportleft(), however..

Yes, that would work, but I need not just that bar but the other items on the layer resized too, all of the score and life and health numbers. 1.3 isn't enormously high for a layer scale, it's only a third(ish) bigger. Can I scale a whole group of items so they're exactly the same relative size? If not, that's why I wanted to use a dynamic layer scale figure depending on the resolution of the players screen.


Why would you use layer scale?
Everything does get scaled automatically..
You didn't want to scale the bar, you wanted to stretch it, that's the difference..

@LittleStain No, I want to scale it, retaining the correct height as well for the bar, I could mock up the bar with some counters and text on it to make it appear more like an HUD if you need? If I stretch the bar, it would look odd when it has HUD items on it, and I would need to get those stretched too, which is why I need it scaling to the right width whilst retaining the correct height. I need the correct height to be retained when the width is met with the side of the screen. I can't see why scaling the layer would be the wrong way of doing this?
B
41
S
12
G
14
Posts: 1,117
Reputation: 11,253

Post » Sun Jan 03, 2016 4:42 pm

Is there really a reason to re-invent the wheel?
The right combination of the anchor behaviour with paralax 0,0 works with any fullscreen setting..

https://dl.dropboxusercontent.com/u/485 ... nchor.capx
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 » Sun Jan 03, 2016 4:53 pm

LittleStain wrote:Is there really a reason to re-invent the wheel?
The right combination of the anchor behaviour with paralax 0,0 works with any fullscreen setting..

https://dl.dropboxusercontent.com/u/485 ... nchor.capx


@littlestain Thanks for the example, here's a new one with a mockup HUD for this exercise, https://www.dropbox.com/s/g4curnknsl789 ... .capx?dl=0 - if you press S to change the scaling, you'll notice it's not wide enough. I doubt I could use anchors to keep everything correctly sized on that change of scaling for this type of HUD?
B
41
S
12
G
14
Posts: 1,117
Reputation: 11,253

Post » Sun Jan 03, 2016 8:38 pm

Zebbi wrote:
LittleStain wrote:Is there really a reason to re-invent the wheel?
The right combination of the anchor behaviour with paralax 0,0 works with any fullscreen setting..

https://dl.dropboxusercontent.com/u/485 ... nchor.capx


@littlestain Thanks for the example, here's a new one with a mockup HUD for this exercise, https://www.dropbox.com/s/g4curnknsl789 ... .capx?dl=0 - if you press S to change the scaling, you'll notice it's not wide enough. I doubt I could use anchors to keep everything correctly sized on that change of scaling for this type of HUD?


I doubt you could too..
I don't doubt it could be done, though..
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 » Sun Jan 03, 2016 8:42 pm

LittleStain wrote:
Zebbi wrote:
LittleStain wrote:Is there really a reason to re-invent the wheel?
The right combination of the anchor behaviour with paralax 0,0 works with any fullscreen setting..

https://dl.dropboxusercontent.com/u/485 ... nchor.capx


@littlestain Thanks for the example, here's a new one with a mockup HUD for this exercise, https://www.dropbox.com/s/g4curnknsl789 ... .capx?dl=0 - if you press S to change the scaling, you'll notice it's not wide enough. I doubt I could use anchors to keep everything correctly sized on that change of scaling for this type of HUD?


I doubt you could too..
I don't doubt it could be done, though..

@littlestain So, would creative usage of anchoring be best for this example I've given, or could things still be resized with some sort of layer scale?
B
41
S
12
G
14
Posts: 1,117
Reputation: 11,253

Post » Sun Jan 03, 2016 8:52 pm

As you have already noticed, using layerscale doesn't give you the results you expect..
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 » Sun Jan 03, 2016 10:21 pm

LittleStain wrote:As you have already noticed, using layerscale doesn't give you the results you expect..

@littlestain mainly I would imagine because I haven't worked out how I could calculate how to dynamically resize a layer with a visual width of 640 to whatever monitor resolution the user is using. If I knew how to get that figure, it might give me the results I expect?
B
41
S
12
G
14
Posts: 1,117
Reputation: 11,253

Post » Mon Jan 04, 2016 12:17 am

You should be able to get the scale with: windowwidth/originalwindowwidth
It most likely won't work the way you'd want it to, though..
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 » Mon Jan 04, 2016 11:03 am

LittleStain wrote:You should be able to get the scale with: windowwidth/originalwindowwidth
It most likely won't work the way you'd want it to, though..

@littlestain Well, it's a bit bigger, but it doesn't reach the full length. Does it need some sort of clever calculation that figures out the users aspect ratio and divides the height in or something?
B
41
S
12
G
14
Posts: 1,117
Reputation: 11,253

PreviousNext

Return to How do I....?

Who is online

Users browsing this forum: Centra, Euduardo, ST314 and 26 guests