Jump to content

Strange issue with sprite and scaling


Gob0
 Share

Recommended Posts

Hi there, 

 

i'm facing a weird problem. I'm using a sprite to display an image (1280px * 80px). The available are to show the image is shorter than image.

At this point, i compute ratio between image size and area size to get the initial scale factor for sprite. 

When i run the game on my computer with Chrome, in "tablet mode" with a screen size of 1024*575px (same size as my samsung tablet), the image is fully displayed. I'm happy (Droopy style)

When i run the game on my tablet (Samsung galaxy Tab 3 7.0), the image is a bit bigger and is not fully displayed. 

 

I log all values (elements sizes, image/area ratio) and values are identical. I don't understand why image is rendered differently with same scale value. What did i miss?

 

Can you help me, it's driving me crazy.

 

Thx.

 

 

Gauthier.

Link to comment
Share on other sites

Well, don't break your mind guys, i've found a way out.

 

I put ScaleManager in "resize mode" (Phaser.ScaleManager.RESIZE), my game is not full screen.

Then, i force ScaleManager game size with this.game.scale.setGameSize(this.game.width, this.game.height)

 

And it works. 

 

(but what is still mysterious is why do i have to put this code to make things right in Chromium/Android while without it works fine on Chrome/Linux). 

 

Thanks for reading! 

 

Gauthier.

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

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