Closed SBCGames closed 5 years ago
Any solution to make tint work with images when using Phaser.CANVAS?
You can make something similar to what I did for BitmapText. In short, you need to take canvas, render image with tint into it and use this new texture instad of image from images/atlas.
Thank you for opening this feature request (all those months ago!). As the development of Phaser 4 has now started I am tidying-up the repo and closing off old issues that won't be directly fixed or implemented in Phaser 3 by me. I would still consider community PRs that address this issue, however, and have left the GitHub tags intact so others can track them if they wish to get involved. However, I'm afraid this is no longer a feature that will be added to v3.
This issue has been mentioned on Phaser. There might be relevant details there:
https://phaser.discourse.group/t/bitmap-text-coloring-in-canvas-rendermode/11076/1
Hi, currently there is no tint support for sprites nor bitmap text when rendering with Phaser.CANVAS. I was playing with BitmapText class and found solution for it.
First, I have question: BitmapText class uses interanal variable _dirty to prevent bounds calculation every frame. _dirty is set to true when text changes... but, it is never set to false. So bounds are recalculated every frame again and again. This looks like bug.
I took this _dirty variable and I am reseting it in method that replaces renderCanvas (BitmapTextCanvasRenderer.js)
Below is whole listing for class that supports tinted BitmapText for Canvas. If it was adopted into Phaser, it does not have to be separate class... Main points are:
Here is .zip with file and below listing: AdjustedBitmapText.zip