Jump to content

Bugs after changing the value of devicePixelRatio grows my frustration


Recommended Posts

Example: https://jsfiddle.net/b3wtg0hn/ 

Phaser CE v2.7.7

I display the image with a size of 200 by 200
In the configuration, the devicePixelRatio property with a value 2

I have two problems:

1) The size of the hit (click) area of the sprite is not changing. It is the same as the original file 200x200. But the displayed sprite is 100x100. B the cursor responds to an invisible area

2)  The function spriteBounds displays an incorrect position of the sprite bounds. I'm about the green box.


I don't know how to fix this. Without using devicePixelRatio everything is blurred on my retina display. It hurts me.

I never used CE version. And I have not had these problems on older versions of Phaser. (But then I used method scale.setTo(0.5) for every sprite)



Link to comment
Share on other sites

1 hour ago, samme said:

It may be just a bug in the debug display.

You can verify the bounds with debug.spriteInfo(…).

debug.spriteInfo() show:

bounds x: 50.0 y 50.0 w: 200.0 h: 200.0

This is not the correct value, right? It does not consider scaling.

Link to comment
Share on other sites

58 minutes ago, samme said:

(50, 50) is correct. These are "virtual" pixels that don't depend on the device.

It's weird, the debug rectangle's position is half what it should be but its size is correct.

I meant about w: 200.0 h: 200.0


45 minutes ago, samme said:

Hm, now I'm confused. :(


Link to comment
Share on other sites


  • Recently Browsing   0 members

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