Strech Canvas

0 favourites
  • 9 posts
From the Asset Store
Pixel Destruction like in "Worms" (Drawing Canvas based)
  • Is there a way to stretch the canvas to fill the whole window?

    Instead of scaling/cropping.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • So instead of "Fullscreen scale" mode, you want... a non-proportional stretch which will distort it wider/taller?

  • Ashley

    Yes! I know it sounds crazy, but I want to test for iOS if I can stretch from iPhone to iPad as the difference in width is not much.

    How can I do it? I tried searching in the html5 exporter for the function you use but I can't find it anywhere, it's the last piece I need to publish on the appstore.

    Thank you!

  • We don't actually support this... I think your best bet is to go with the fullscreen scale mode! It's actually a little trickier than you might think because an important part of the engine is converting screen co-ordinates to layout co-ordinates and back again, and for various reasons the math only supports a single scale value, not different scale values on the X and Y axes.

  • ASHLEY. Then you might have a problem. In my application (which has fixed elements) the resizing on the iPad destroys everything, meaning that the sprites leave a trail to the left size of the screen! Not only that, but the resizing creates problem with the injection of a new sprite (which is not your fault since it's a plugin but still).. is it possible then to have a conditional statement to change between crop and scale inside the code? To avoid building two times..

  • 0plus1 - try setting the 'Clear background' project property to 'Yes' to fix trailing backgrounds.

  • Ashley I'll try that, but my main problem is the ugly white column, so far I have two solution, for both I need your imput.

    1) Change the layout size as an action, I didn't see a way to do this, but maybe there is. If there isn't is it possible to do this with a plugin? What I mean is I have a layout that has a property of 100x100 I change it at runtime to 200x200.

    2) If the previous is not possible I could create two or more layouts in order to have different aspect ratios, but! Is the Window Size property a constraint? Or is it only used for the initial canvas size (before resizing)?

  • There's no need to change the layout size, just set 'Unbounded scrolling' to 'Yes' and you get an infinite layout area.

    You should be able to fairly straightforwardly support multiple aspect ratios from one project. I added a new section in supporting multiple screen sizes recently which covers it.

  • Ashley thanks, this is really interesting.

    So I could stretch the background based on the WindowHeight and Width properties myself and position all objects to the center of the screen and I would be done.

    Still there is another small issue, on the iPad everytime you change layout with scale mode the layout starts in the center and then goes to the left side leaving a trail, you already told me about clear background (which also impacts performance as shown in another tutorial). If I set the unbounded scrolling what happens then?

    To me it looks like this will happen:

    c2 still has the aspect ratio of 1.5 (iPhone). The layout loads, the canvas get resized, only this time the background covers everything (I imagine this happens BEFORE any of my actions) then I reposition my objects and I would have a "simulation" of native resolution, is this right? But the ghosting will still happen without setting the clear background right? DId I got this right?

    If this is the case this is really genious and you are one of the few frameworks that can support multiple aspect ratios out of the box!

    If I'll ever be able to finish my app I'll write a detailed tutorial on making apps for iOS because there are several issues to get around to and most of them require messing with the code.

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