Scale layout/canvas to suit any resolution

0 favourites
  • 3 posts
From the Asset Store
Adjusting the game screen for different resolutions (Letterbox scale)
  • Hi guys,

    I made a little test project to allow a canvas to actually resize to fit ANY screen resolution, on the fly. The red squares will find the corners of the canvas and move to them. I set them to move with lerp so you can see it in action. Notice the sqaures do not scale as the size of the layout/canvas is adjusted.

    I did this, mainly to tackle problems I'm personally having with making projects that would suit any device (fullscreen) - while not forcing an aspect ratio or orientation.

    I wanted to build something that would dynamically reposition itself on any device, any resolution, any aspect.

    Key factors in this project are to set your scaling method to scale outer (I think scale inner works as well), and to set to unbounded scrolling. Every object is then placed using ViewportLeft,ViewportRight,ViewportBottom,ViewportTop (which you could simplify by tracking those with some global variables or something).

    Again, I just made this to solve one of my own issues, but thought it may be useful for some other people to help with this annoying issue. You could also incorporate a scale modifier if you wanted to maintain a given scale for your objects.

    LINK: https://www.dropbox.com/s/gg2lzx8np5u5lho/CANVAS_RESCALER.capx?dl=0

    *EDIT*

    Realised I had RexRandom plugin in the project for some reason. I was messing with some other stuff and forgot to remove it. Should be a lot more user-friendly now. Sorry about that!

    ~Sol

  • This is really useful for cross platforms, thank you very much for this!

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • This is really useful for cross platforms, thank you very much for this!

    No problem at all. I'm glad someone has found it useful!

    ~Sol

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