Fixed #3133 (probably) / Logic icon draw command

This commit is contained in:
Anuken
2020-10-26 13:31:32 -04:00
parent a2181fec48
commit 8770bb2422
19 changed files with 6314 additions and 4076 deletions

View File

@@ -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.*/