feat: dynamic texture coloring
This commit is contained in:
parent
026c2aaef9
commit
f5d9cbc011
|
@ -34,21 +34,18 @@ public class Player extends EntityQuad {
|
||||||
pm.setBlending(Pixmap.Blending.None);
|
pm.setBlending(Pixmap.Blending.None);
|
||||||
for (int x = 0; x < pm.getWidth(); x++) {
|
for (int x = 0; x < pm.getWidth(); x++) {
|
||||||
for (int y = 0; y < pm.getHeight(); y++) {
|
for (int y = 0; y < pm.getHeight(); y++) {
|
||||||
int p = pm.getPixel(x, y);
|
|
||||||
int r = (int)( (p & 0xff000000)>>24 );
|
Color pc = new Color();
|
||||||
int g = (int)( (p & 0x00ff0000)>>16 );
|
Color.rgba8888ToColor(pc, pm.getPixel(x, y));
|
||||||
int b = (int)( (p & 0x0000ff00)>>8 );
|
|
||||||
int a = (int)( p & 0x000000ff );
|
if (pc.equals(Color.WHITE)) { // pc.r == 1 && pc.g == 1 && pc.b == 1
|
||||||
if (p != 0) {
|
pc = Color.RED;
|
||||||
if (r == 255 && g == 255 && b == 255) {
|
// pc.r = 1;
|
||||||
r = 255;
|
// pc.g = 0;
|
||||||
g = 0;
|
// pc.b = 0;
|
||||||
b = 0;
|
|
||||||
a = 255;
|
|
||||||
p = (int)( r <<24 | g << 16 | b << 8 | a );
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
pm.drawPixel(x, y, p);
|
pm.drawPixel(x, y, Color.rgba8888(pc));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
texture = new Texture(pm);
|
texture = new Texture(pm);
|
||||||
|
|
Loading…
Reference in a new issue