Jump to content

possible bug in Phaser v2.4.2


crispy
 Share

Recommended Posts

When running the following code, the line and the fill of the rect don't line up:

  function create() {    game.stage.backgroundColor = 0xFFFFFF;    gfx = game.add.graphics(0, 0);    gfx.scale.set(100);    gfx.lineStyle(0.1, 0xB22222, 1.0); // darkish red    gfx.beginFill(0xB0C4DE, 1); // light grey-blue    gfx.drawRect(1, 1, 1, 1);    gfx.endFill();  }

It ends up looking like this:

 

post-15974-0-39311700-1439782520.png

 

However, if I instead just multiply the line width and rect values by 100 and don't set the scaling, everything works fine:

  function create() {    game.stage.backgroundColor = 0xFFFFFF;    gfx = game.add.graphics(0, 0);    gfx.lineStyle(10, 0xB22222, 1.0); // darkish red    gfx.beginFill(0xB0C4DE, 1); // light grey-blue    gfx.drawRect(100, 100, 100, 100);    gfx.endFill();  }

post-15974-0-17362800-1439782604.png

 

Any idea what's going on? Is this a bug, or am I doing something wrong?

Link to comment
Share on other sites

Upon further investigation, I noticed that it's offset by 0.5 in each direction, which gave it away: someone was being way too clever. :-[

 

There are already several bugs reported for this:

 

https://github.com/pixijs/pixi.js/issues/711

https://github.com/pixijs/pixi.js/issues/1620

 

The problem is in PIXI.WebGLGraphics.buildLine(), where it just adds 0.5 (not 0.5 pixels! just 0.5) to all of the points.

 

Sadly, this has been a known problem for over a year, so I don't know that it's going to be fixed any time soon.

Link to comment
Share on other sites

  • 2 weeks later...
 Share

  • Recently Browsing   0 members

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