-
Notifications
You must be signed in to change notification settings - Fork 7.1k
DynamicBitmapText displayCallback seems to reverse red and blue channel. #5225
Copy link
Copy link
Closed
Description
Version
- Phaser Version: 3.24.1
- Operating system: Kubuntu (Linux)
- Browser: Firefox
Description
For DynamicBitmapText.setDisplayCallback, when setting the characters color, the red and blue channels seem to be reversed.
It works fine when setting the DynamicBitmapText's tint color. Just not individual characters.
I think the problem lines are 236-239 in: DynamicBitmapTextWebGLRenderer.js
Where it calls: Utils.getTintAppendFloatAlpha
Example Test Code
this.text = this.add.dynamicBitmapText(16, 16, "font", "This should be red.");
this.text.setDisplayCallback((data) => {
data.color = 0xff0000;
return data;
});Additional Information
I got it to work by swapping the r and b:
this.text = this.add.dynamicBitmapText(16, 16, "font", "This should be red.");
this.text.setDisplayCallback((data) => {
data.color = 0xff0000;
var b = data.color & 255;
var g = (data.color >> 8) & 255;
var r = (data.color >> 16) & 255;
data.color = (1 << 24) + (b << 16) + (g << 8) + r;
return data;
});Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels