Jump to content

Responsive Pixijs


schemagroup
 Share

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.

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.

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

  • Recently Browsing   0 members

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