Merge branch 'master' of git.inpt.fr:tobgang/sagittarius

This commit is contained in:
Laureηt 2021-05-12 17:51:34 +02:00
commit 026c2aaef9

View file

@ -2,7 +2,9 @@ package sagittarius.model;
import com.badlogic.gdx.Gdx; import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.Input.Keys; import com.badlogic.gdx.Input.Keys;
import com.badlogic.gdx.files.FileHandle;
import com.badlogic.gdx.graphics.Color; import com.badlogic.gdx.graphics.Color;
import com.badlogic.gdx.graphics.Pixmap;
import com.badlogic.gdx.graphics.Texture; import com.badlogic.gdx.graphics.Texture;
import com.badlogic.gdx.graphics.g2d.Batch; import com.badlogic.gdx.graphics.g2d.Batch;
import com.badlogic.gdx.graphics.glutils.ShapeRenderer; import com.badlogic.gdx.graphics.glutils.ShapeRenderer;
@ -28,6 +30,28 @@ public class Player extends EntityQuad {
this.home = home; this.home = home;
this.texture = new Texture("core/assets/player1.png"); this.texture = new Texture("core/assets/player1.png");
Pixmap pm = new Pixmap(new FileHandle("core/assets/player1.png"));
pm.setBlending(Pixmap.Blending.None);
for (int x = 0; x < pm.getWidth(); x++) {
for (int y = 0; y < pm.getHeight(); y++) {
int p = pm.getPixel(x, y);
int r = (int)( (p & 0xff000000)>>24 );
int g = (int)( (p & 0x00ff0000)>>16 );
int b = (int)( (p & 0x0000ff00)>>8 );
int a = (int)( p & 0x000000ff );
if (p != 0) {
if (r == 255 && g == 255 && b == 255) {
r = 255;
g = 0;
b = 0;
a = 255;
p = (int)( r <<24 | g << 16 | b << 8 | a );
}
}
pm.drawPixel(x, y, p);
}
}
texture = new Texture(pm);
} }
// ---------- METHODs ---------- // ---------- METHODs ----------