Sign in to follow this  
Gob0

Strange issue with sprite and scaling

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.

Share this post


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

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.