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

Get help using Construct 2

Post » Mon Jan 04, 2016 1:26 pm

Zebbi wrote:
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?


I'm sorry, but I don't think I can be of any further help on this topic..
You'll have to re-invent the wheel yourself, or use the one that is already available..
I gave you a link to a working example of one way to do the scaling and I guess that's all I can do..

By the way, you should really adjust the origins of your sprites in the hud example capx..
Also, adjusting the settings of the anchor behaviour is ofcourse nescessary for it to work..
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 2:29 pm

LittleStain wrote:
Zebbi wrote:
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?


I'm sorry, but I don't think I can be of any further help on this topic..
You'll have to re-invent the wheel yourself, or use the one that is already available..
I gave you a link to a working example of one way to do the scaling and I guess that's all I can do..

By the way, you should really adjust the origins of your sprites in the hud example capx..
Also, adjusting the settings of the anchor behaviour is ofcourse nescessary for it to work..

Thanks for your help so far, @littlestain so it may be possible to do this for all of the HUD elements with anchoring?
B
41
S
12
G
14
Posts: 1,120
Reputation: 11,259

Post » Mon Jan 04, 2016 6:51 pm

Did it with anchors, just like css, thanks for all of your help @littlestain !
B
41
S
12
G
14
Posts: 1,120
Reputation: 11,259

Previous

Return to How do I....?

Who is online

Users browsing this forum: Yahoo [Bot] and 27 guests