mirror of
https://github.com/collinsmith/riiablo.git
synced 2025-01-19 16:57:20 +07:00
Added Textures class to store some common solid color textures
This commit is contained in:
parent
ab779a4fce
commit
605bd6f7f2
@ -99,6 +99,7 @@ public class Client extends Game {
|
||||
private Colors colors;
|
||||
private Cursor cursor;
|
||||
private Audio audio;
|
||||
private Textures textures;
|
||||
|
||||
private boolean forceWindowed;
|
||||
private boolean forceDrawFps;
|
||||
@ -219,6 +220,7 @@ public class Client extends Game {
|
||||
Diablo.colors = colors = new Colors();
|
||||
Diablo.cursor = cursor = new Cursor();
|
||||
Diablo.audio = audio = new Audio(assets);
|
||||
Diablo.textures = textures = new Textures();
|
||||
|
||||
Collection<Throwable> throwables;
|
||||
Diablo.commands = commands = new GdxCommandManager();
|
||||
@ -426,6 +428,7 @@ public class Client extends Game {
|
||||
Diablo.colors = colors;
|
||||
Diablo.cursor = cursor;
|
||||
Diablo.audio = audio;
|
||||
Diablo.textures = textures;
|
||||
super.resume();
|
||||
}
|
||||
|
||||
@ -458,6 +461,7 @@ public class Client extends Game {
|
||||
Gdx.app.debug(TAG, "Disposing assets...");
|
||||
palettes.dispose();
|
||||
colormaps.dispose();
|
||||
textures.dispose();
|
||||
assets.dispose();
|
||||
|
||||
try {
|
||||
|
@ -48,4 +48,5 @@ public class Diablo {
|
||||
public static DT1s dt1s;
|
||||
public static Cursor cursor;
|
||||
public static Audio audio;
|
||||
public static Textures textures;
|
||||
}
|
||||
|
28
core/src/gdx/diablo/Textures.java
Normal file
28
core/src/gdx/diablo/Textures.java
Normal file
@ -0,0 +1,28 @@
|
||||
package gdx.diablo;
|
||||
|
||||
import com.badlogic.gdx.graphics.Color;
|
||||
import com.badlogic.gdx.graphics.Pixmap;
|
||||
import com.badlogic.gdx.graphics.Texture;
|
||||
import com.badlogic.gdx.utils.Disposable;
|
||||
|
||||
public class Textures implements Disposable {
|
||||
public final Texture white;
|
||||
|
||||
public Textures() {
|
||||
white = createTexture(Diablo.colors.white);
|
||||
}
|
||||
|
||||
public Texture createTexture(Color color) {
|
||||
Pixmap pixmap = new Pixmap(1, 1, Pixmap.Format.RGBA8888);
|
||||
pixmap.setColor(color);
|
||||
pixmap.fill();
|
||||
Texture texture = new Texture(pixmap);
|
||||
pixmap.dispose();
|
||||
return texture;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void dispose() {
|
||||
white.dispose();
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user