Jump to content

Pixels, percents and parents?


Recommended Posts

I'm trying to port a game I've made in another language to JavaScript and Phaser. And I've run in to a problem with the way pixels are handled.

I'm used to working with a percentage-system where the screen is in percent rather than actual pixels. So 0, 0 is the top left and 100, 100 is the bottom right. According to the documentation I should give the size in game pixels. So I thought if I create a game with 100 by 100 game pixels it would scale to the parent element. It did not, instead a game of 100 by 100 actual pixels was created.

So is there way to achieve what I'm trying to do? How do target different devices with different resolutions and aspect ratios if all pixels always are physical pixels?

Link to comment
Share on other sites


  • Recently Browsing   0 members

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