How do I resize a sprite to match viewport

Get help using Construct 2

Post » Wed Apr 16, 2014 8:41 pm

I'm trying to resize a sprite to match the viewport. I resize and position the sprite in a "On resize" event.
the thing is that in Chrome browser doesn't work correctly and in Firefox it does most of the time with some glitches. Haven't tested in IE yet.

One correction to the above (and the important thing): It works if I resize the browser window from the corner but it seems that the trigger doesn't fire correctly on maximizing and restoring the window

I wanted to share this before I posted it to Bugs to see if I'm missing something.

The capx:
testeo_de_posisionado-r163.capx


Thanks!
You do not have the required permissions to view the files attached to this post.
B
34
S
8
G
5
Posts: 32
Reputation: 5,399

Post » Wed Apr 16, 2014 11:55 pm

Browser: On resized: Wait 0.1s, call function "position"

:)
My professional Royalty Free Music at Scirra Assets Store
--------------------------------
Specs: i5 2500, 16gb of ram, gtx 770, win 7, Focusrite Scarlett 8i6, Mackie mr8mk2, Alesis 320, browsing the net on chrome.
B
85
S
27
G
20
Posts: 1,962
Reputation: 18,651

Post » Thu Apr 17, 2014 12:45 pm

megatronx wrote:Browser: On resized: Wait 0.1s, call function "position"

:)

Excellent! I knew there was a quick fix. Thanks.

Nevertheless, don't you think it should work without waiting?
B
34
S
8
G
5
Posts: 32
Reputation: 5,399

Post » Thu Apr 17, 2014 1:00 pm

AVIX wrote:
megatronx wrote:Browser: On resized: Wait 0.1s, call function "position"

:)

Excellent! I knew there was a quick fix. Thanks.

Nevertheless, don't you think it should work without waiting?


It should actually, because of the timing differences between canvas and browser resizing ( at least that's the behavior I observed when trying your capx ).
My professional Royalty Free Music at Scirra Assets Store
--------------------------------
Specs: i5 2500, 16gb of ram, gtx 770, win 7, Focusrite Scarlett 8i6, Mackie mr8mk2, Alesis 320, browsing the net on chrome.
B
85
S
27
G
20
Posts: 1,962
Reputation: 18,651


Return to How do I....?

Who is online

Users browsing this forum: Cubus32, tarek2 and 8 guests