Sign in to follow this  
schemagroup

Responsive Pixijs

Recommended Posts

Assuming you're talking about how the game view is handled and not for example interaction responsivines.

I usually use a combination of these methods:

- Locked aspect ratios. Build your game around a known aspect ratio (for example 16:9 (landscape) and 9:16 (portrait)). Then just scale the known area to fit to the screen and add some extra graphics to edges so there will be no black borders.

- Dynamically positioned elements. Create somekind of logic for having your elements be completely dynamic in regards to where they are. Works great in games where ui is separate from the "action" area.

- Fixed canvas and transform it to fit. This is the easiest way, build your game with a fixed canvas size and then just use css to fit it to given screen.

An example of these would be a game where your character adventures in a world. You could have one container which has the actual world with player character and everything you interact with and that would be rendered so that you always see a predetermined amount of the world. Then on top of that you would have your UI with controls and other information. That would be rendered directly in relation to canvas size. Action buttons aligning to bottom right and movement to bottom left with health bar at the top. It could even have certain fixed minimum canvas size, after which a css scaling would be toggled on if screen was smaller than smallest configured resolution.

Also remember to setup your viewport meta tag. More info on that can be found at pixi wiki (https://github.com/pixijs/pixi.js/wiki/v4-Gotchas)

Responsive design is a really large field, so giving a single answer without knowing whatkind of project is being done is impossible. Hopefully some of those methods shown help.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.