v0.4.2: reduced amount of allocations occurring when frames are drawn
This commit is contained in:
committed by
Evan Debenham
parent
9663a47958
commit
b821bfddf8
@@ -100,6 +100,7 @@ import com.shatteredpixel.shatteredpixeldungeon.sprites.HeroSprite;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.ui.AttackIndicator;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.ui.BuffIndicator;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.ui.QuickSlotButton;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.ui.StatusPane;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.utils.BArray;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.utils.GLog;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.windows.WndMessage;
|
||||
@@ -1406,6 +1407,7 @@ public class Hero extends Char {
|
||||
belongings.specialKeys[Dungeon.depth]--;
|
||||
Level.set( doorCell, Terrain.UNLOCKED_EXIT );
|
||||
}
|
||||
StatusPane.needsKeyUpdate = true;
|
||||
|
||||
Level.set( doorCell, door == Terrain.LOCKED_DOOR ? Terrain.DOOR : Terrain.UNLOCKED_EXIT );
|
||||
GameScene.updateMap( doorCell );
|
||||
|
||||
@@ -24,6 +24,7 @@ import com.shatteredpixel.shatteredpixeldungeon.Assets;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.Item;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.ui.StatusPane;
|
||||
import com.watabou.noosa.audio.Sample;
|
||||
import com.watabou.utils.Bundle;
|
||||
|
||||
@@ -48,6 +49,7 @@ public abstract class Key extends Item {
|
||||
GameScene.pickUpJournal(this);
|
||||
Sample.INSTANCE.play( Assets.SND_ITEM );
|
||||
hero.spendAndNext( TIME_TO_PICK_UP );
|
||||
StatusPane.needsKeyUpdate = true;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -231,6 +231,8 @@ public class StatusPane extends Component {
|
||||
true );
|
||||
}
|
||||
|
||||
public static boolean needsKeyUpdate = false;
|
||||
|
||||
private static class JournalButton extends Button {
|
||||
|
||||
private Image bg;
|
||||
@@ -253,6 +255,7 @@ public class StatusPane extends Component {
|
||||
|
||||
icon = new Image( Assets.MENU, 31, 0, 11, 7);
|
||||
add( icon );
|
||||
needsKeyUpdate = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -270,10 +273,13 @@ public class StatusPane extends Component {
|
||||
@Override
|
||||
public void update() {
|
||||
super.update();
|
||||
updateKeyDisplay();
|
||||
if (needsKeyUpdate)
|
||||
updateKeyDisplay();
|
||||
}
|
||||
|
||||
public void updateKeyDisplay() {
|
||||
needsKeyUpdate = false;
|
||||
|
||||
boolean foundKeys = false;
|
||||
boolean blackKey = false;
|
||||
boolean specialKey = false;
|
||||
|
||||
Reference in New Issue
Block a user