Jump to content

Background safe area scaling with window size


Recommended Posts

Things that you have to study (look in docs, source code):

1. Renderer.resize and its super.

2. container.position, container.scale, container.pivot. If you want to do something in center of screen. position = center, pivot=local coords of that center. Go figure out how those two work.

3. CSS resize. "canvas.width" and "canvas.style.width" are different things. you can scale canvas instead and get a result. Also margin-left margin-top and other CSS things.

Algorithm that is suited for your game is born from those three things. Unfortunately, only a few people made that and reported back their findings, and I cant solve every person issues because, actually, its different for everyone :( If you solve your case , please make an article or at least small post here, maybe we'll get to more general case based on everything people report :)


Someone's medium article: https://medium.com/@michelfariarj/scale-a-pixi-js-game-to-fit-the-screen-1a32f8730e9c

More of those threads:


Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...