Jump to content

Some text is blurred some is crisp.


Tymski
 Share

Recommended Posts

  • 2 months later...

You use anchor.x = 0.5, right? I use custom rounding for sprite coords often. Something like that might work:

PIXI.Sprite.prototype.centerXY = function() {
   var orig = this._texture._orig;
   this.anchor.x = (orig.width >> 1) / orig.width;
   this.anchor.y = (orig.height >> 1) / orig.height;
}

function centerXYOnUpdate() {
   PIXI.Sprite.prototype._onTextureUpdate.call(this);
   this.centerXY();
}

// when i want to center whole text by XY
text.centerXY();
// add automatic handler when i change the text
text.onTextureUpdate = centerXYOnUpdate;

Please note that I just wrote this from scratch and I dont know if it works, you have to debug it. I dont want to explain it further.

Link to comment
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...
 Share

  • Recently Browsing   0 members

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