v0.6.3: fixed variosu bugs with fog of war and horn of plenty
This commit is contained in:
parent
869c17be41
commit
0182bae2a0
|
@ -87,29 +87,17 @@ public class TextureCache {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//creates a smarttexture backed by a native intbuffer, not a bitmap.
|
|
||||||
//This is much faster is the texture needs to be frequently edited.
|
|
||||||
//texture is all black by default
|
|
||||||
public static SmartTexture createBufferTex( String key, int w, int h ){
|
|
||||||
|
|
||||||
key += "w" + w + "h" + h;
|
|
||||||
|
|
||||||
if (all.containsKey( key )){
|
|
||||||
|
|
||||||
return all.get( key );
|
|
||||||
|
|
||||||
} else {
|
|
||||||
|
|
||||||
BufferTexture tx = new BufferTexture(w, h);
|
|
||||||
all.put( key, tx);
|
|
||||||
return tx;
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void add( Object key, SmartTexture tx ) {
|
public static void add( Object key, SmartTexture tx ) {
|
||||||
all.put( key, tx );
|
all.put( key, tx );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void remove( Object key ){
|
||||||
|
SmartTexture tx = all.get( key );
|
||||||
|
if (tx != null){
|
||||||
|
all.remove(key);
|
||||||
|
tx.delete();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public static SmartTexture get( Object src ) {
|
public static SmartTexture get( Object src ) {
|
||||||
|
|
||||||
|
|
|
@ -127,6 +127,7 @@ public class HornOfPlenty extends Artifact {
|
||||||
if (charge >= 15) image = ItemSpriteSheet.ARTIFACT_HORN4;
|
if (charge >= 15) image = ItemSpriteSheet.ARTIFACT_HORN4;
|
||||||
else if (charge >= 10) image = ItemSpriteSheet.ARTIFACT_HORN3;
|
else if (charge >= 10) image = ItemSpriteSheet.ARTIFACT_HORN3;
|
||||||
else if (charge >= 5) image = ItemSpriteSheet.ARTIFACT_HORN2;
|
else if (charge >= 5) image = ItemSpriteSheet.ARTIFACT_HORN2;
|
||||||
|
else image = ItemSpriteSheet.ARTIFACT_HORN1;
|
||||||
|
|
||||||
updateQuickslot();
|
updateQuickslot();
|
||||||
}
|
}
|
||||||
|
|
|
@ -110,7 +110,9 @@ public class FogOfWar extends Image {
|
||||||
width = width2 * size;
|
width = width2 * size;
|
||||||
height = height2 * size;
|
height = height2 * size;
|
||||||
|
|
||||||
texture( TextureCache.createBufferTex("fog", width2, height2) );
|
BufferTexture tx = new BufferTexture(width2, height2);
|
||||||
|
TextureCache.add(FogOfWar.class, tx);
|
||||||
|
texture( tx );
|
||||||
|
|
||||||
scale.set(
|
scale.set(
|
||||||
DungeonTilemap.SIZE / PIX_PER_TILE,
|
DungeonTilemap.SIZE / PIX_PER_TILE,
|
||||||
|
@ -342,7 +344,7 @@ public class FogOfWar extends Image {
|
||||||
public void destroy() {
|
public void destroy() {
|
||||||
super.destroy();
|
super.destroy();
|
||||||
if (texture != null){
|
if (texture != null){
|
||||||
texture.delete();
|
TextureCache.remove(FogOfWar.class);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user