combler les trous des planets
This commit is contained in:
parent
d1d4bcacf2
commit
1770a819bf
|
@ -15,7 +15,7 @@ public class Planet extends EntityCircle {
|
||||||
// ---------- ATTRIBUTEs ----------
|
// ---------- ATTRIBUTEs ----------
|
||||||
|
|
||||||
float revolutionRate = MathUtils.randomTriangular(1) + 1;
|
float revolutionRate = MathUtils.randomTriangular(1) + 1;
|
||||||
private Texture texture;
|
private Texture texture, backGround;
|
||||||
|
|
||||||
// ---------- CONSTRUCTORs ----------
|
// ---------- CONSTRUCTORs ----------
|
||||||
|
|
||||||
|
@ -47,6 +47,26 @@ public class Planet extends EntityCircle {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
texture = new Texture(pm);
|
texture = new Texture(pm);
|
||||||
|
|
||||||
|
pm = new Pixmap(new FileHandle("core/assets/planet0.png"));
|
||||||
|
pm.setBlending(Pixmap.Blending.None);
|
||||||
|
for (int x = 0; x < pm.getWidth(); x++) {
|
||||||
|
for (int y = 0; y < pm.getHeight(); y++) {
|
||||||
|
|
||||||
|
Color pc = new Color();
|
||||||
|
Color.rgba8888ToColor(pc, pm.getPixel(x, y));
|
||||||
|
|
||||||
|
if (pc.r == 1 && pc.g == 1 && pc.b == 1) {
|
||||||
|
pc.r = color.r;
|
||||||
|
pc.g = color.g;
|
||||||
|
pc.b = color.b;
|
||||||
|
pc.a = 0.5f;
|
||||||
|
}
|
||||||
|
|
||||||
|
pm.drawPixel(x, y, Color.rgba8888(pc));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
backGround = new Texture(pm);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ---------- METHODs ----------
|
// ---------- METHODs ----------
|
||||||
|
@ -68,6 +88,8 @@ public class Planet extends EntityCircle {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void draw(Batch batch, float parentAlpha) {
|
public void draw(Batch batch, float parentAlpha) {
|
||||||
|
batch.draw(backGround, getPosition().x - this.radius, getPosition().y - this.radius, this.radius, this.radius, 2 * this.radius, 2 * this.radius,
|
||||||
|
1, 1, getRotation(), 0, 0, texture.getWidth(), texture.getHeight(), false, false);
|
||||||
batch.draw(texture, getPosition().x - this.radius, getPosition().y - this.radius, this.radius, this.radius, 2 * this.radius, 2 * this.radius,
|
batch.draw(texture, getPosition().x - this.radius, getPosition().y - this.radius, this.radius, this.radius, 2 * this.radius, 2 * this.radius,
|
||||||
1, 1, getRotation(), 0, 0, texture.getWidth(), texture.getHeight(), false, false);
|
1, 1, getRotation(), 0, 0, texture.getWidth(), texture.getHeight(), false, false);
|
||||||
super.draw(batch, parentAlpha);
|
super.draw(batch, parentAlpha);
|
||||||
|
|
Loading…
Reference in a new issue