v0.9.4: fixed rare texture errors in fog of war

This commit is contained in:
Evan Debenham 2021-08-13 22:46:11 -04:00
parent a5e50a7d68
commit b08f3479c1
2 changed files with 8 additions and 7 deletions

View File

@ -79,7 +79,8 @@ public class TextureCache {
}
//texture defaults to black and given size, but no assurance is made about this is another already exists
//texture is created at given size, but size is not enforced if it already exists
//texture contents are also not enforced, make sure you know the texture's state!
public synchronized static SmartTexture create( Object key, int width, int height ) {
if (all.containsKey( key )) {
@ -88,12 +89,7 @@ public class TextureCache {
} else {
Pixmap pixmap = new Pixmap( width, height, Pixmap.Format.RGBA8888 );
pixmap.setColor(0x000000FF);
pixmap.fill();
SmartTexture tx = new SmartTexture( pixmap );
SmartTexture tx = new SmartTexture(new Pixmap( width, height, Pixmap.Format.RGBA8888 ));
tx.filter( Texture.LINEAR, Texture.LINEAR );
tx.wrap( Texture.CLAMP, Texture.CLAMP );

View File

@ -112,6 +112,11 @@ public class FogOfWar extends Image {
String key = "FogOfWar" + width2 + "x" + height2;
texture(TextureCache.create(key, width2, height2));
//sets contents to all black
texture.bitmap.setColor( 0x000000FF );
texture.bitmap.fill();
texture.bind();
scale.set( size, size );