v0.9.4: fixed buff icons not being refreshable

This commit is contained in:
Evan Debenham 2021-07-12 22:03:23 -04:00
parent 74762c158f
commit 20226d2946
2 changed files with 15 additions and 3 deletions

View File

@ -13,15 +13,27 @@ public class BuffIcon extends Image {
private static TextureFilm largeFilm;
private static final int LRG_SIZE = 16;
private final boolean large;
//TODO maybe roll fading behaviour into this too?
public BuffIcon(Buff buff, boolean large){
this(buff.icon(), large);
buff.tintIcon(this);
super( large ? Assets.Interfaces.BUFFS_LARGE : Assets.Interfaces.BUFFS_SMALL );
this.large = large;
refresh(buff);
}
public BuffIcon(int icon, boolean large){
super( large ? Assets.Interfaces.BUFFS_LARGE : Assets.Interfaces.BUFFS_SMALL );
this.large = large;
refresh(icon);
}
public void refresh(Buff buff){
refresh(buff.icon());
buff.tintIcon(this);
}
public void refresh(int icon){
if (large){
if (largeFilm == null) largeFilm = new TextureFilm(texture, LRG_SIZE, LRG_SIZE);
frame(largeFilm.get(icon));

View File

@ -212,7 +212,7 @@ public class BuffIndicator extends Component {
}
public void updateIcon(){
buff.tintIcon(icon);
((BuffIcon)icon).refresh(buff);
//round up to the nearest pixel if <50% faded, otherwise round down
float fadeHeight = buff.iconFadePercent() * icon.height();
float zoom = (camera() != null) ? camera().zoom : 1;