Fixed #3133 (probably) / Logic icon draw command
This commit is contained in:
@@ -22,7 +22,9 @@ import arc.scene.style.*;
|
||||
import arc.scene.ui.layout.*;
|
||||
import arc.struct.*;
|
||||
import arc.util.*;
|
||||
import mindustry.*;
|
||||
import mindustry.core.*;
|
||||
import mindustry.ctype.*;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
@@ -30,6 +32,8 @@ public class Fonts{
|
||||
private static final String mainFont = "fonts/font.woff";
|
||||
private static ObjectIntMap<String> unicodeIcons = new ObjectIntMap<>();
|
||||
private static ObjectMap<String, String> stringIcons = new ObjectMap<>();
|
||||
private static TextureRegion[] iconTable;
|
||||
private static int lastCid;
|
||||
|
||||
public static Font def;
|
||||
public static Font outline;
|
||||
@@ -37,6 +41,10 @@ public class Fonts{
|
||||
public static Font icon;
|
||||
public static Font tech;
|
||||
|
||||
public static TextureRegion logicIcon(int id){
|
||||
return iconTable[id];
|
||||
}
|
||||
|
||||
public static int getUnicode(String content){
|
||||
return unicodeIcons.get(content, 0);
|
||||
}
|
||||
@@ -111,6 +119,19 @@ public class Fonts{
|
||||
fonts.each(f -> f.getData().setGlyph(ch, glyph));
|
||||
}
|
||||
}
|
||||
|
||||
iconTable = new TextureRegion[512];
|
||||
iconTable[0] = Core.atlas.find("error");
|
||||
lastCid = 1;
|
||||
|
||||
Vars.content.each(c -> {
|
||||
if(c instanceof UnlockableContent u){
|
||||
TextureRegion region = Core.atlas.find(u.name + "-icon-logic");
|
||||
if(region.found()){
|
||||
iconTable[u.iconId = lastCid++] = region;
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/** Called from a static context for use in the loading screen.*/
|
||||
|
||||
@@ -640,6 +640,8 @@ public class HudFragment extends Fragment{
|
||||
public void draw(){
|
||||
float next = amount.get();
|
||||
|
||||
if(Float.isNaN(next) || Float.isInfinite(next)) next = 1f;
|
||||
|
||||
if(next < last && flash.get()){
|
||||
blink = 1f;
|
||||
}
|
||||
@@ -648,6 +650,8 @@ public class HudFragment extends Fragment{
|
||||
value = Mathf.lerpDelta(value, next, 0.15f);
|
||||
last = next;
|
||||
|
||||
if(Float.isNaN(value) || Float.isInfinite(value)) value = 1f;
|
||||
|
||||
drawInner(Pal.darkishGray);
|
||||
|
||||
Draw.beginStencil();
|
||||
|
||||
Reference in New Issue
Block a user