How do I resize a sprite to match viewport

  • 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: [attachment=1:20hhx215][/attachment:20hhx215]

    Thanks!

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Browser: On resized: Wait 0.1s, call function "position"

  • 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?

  • > 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 ).

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)