Sign in to follow this  
Wisheechia

Background safe area scaling with window size

Recommended Posts

Hi guys, I need help with my game. 

I'm working on game/background resizing. Actually, I improved my game resize function studying this article (http://www.williammalone.com/articles/html5-game-scaling/, the second part doesnt work for me..), so now I have problem with scaling background to a safe area. Can someone help me?

Share this post


Link to post
Share on other sites

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:

 

Share this post


Link to post
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.

Guest
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.

Loading...
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.