Single-texture font+UI packing
This commit is contained in:
@@ -1,5 +1,9 @@
|
|||||||
package mindustry.annotations;
|
package mindustry.annotations;
|
||||||
|
|
||||||
|
import arc.files.*;
|
||||||
|
import arc.scene.style.*;
|
||||||
|
import arc.struct.*;
|
||||||
|
import arc.util.serialization.*;
|
||||||
import com.squareup.javapoet.*;
|
import com.squareup.javapoet.*;
|
||||||
import mindustry.annotations.Annotations.*;
|
import mindustry.annotations.Annotations.*;
|
||||||
|
|
||||||
@@ -8,7 +12,6 @@ import javax.lang.model.*;
|
|||||||
import javax.lang.model.element.*;
|
import javax.lang.model.element.*;
|
||||||
import javax.tools.Diagnostic.*;
|
import javax.tools.Diagnostic.*;
|
||||||
import javax.tools.*;
|
import javax.tools.*;
|
||||||
import java.nio.file.*;
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
@SupportedSourceVersion(SourceVersion.RELEASE_8)
|
@SupportedSourceVersion(SourceVersion.RELEASE_8)
|
||||||
@@ -34,9 +37,9 @@ public class AssetsAnnotationProcessor extends AbstractProcessor{
|
|||||||
if(round++ != 0) return false; //only process 1 round
|
if(round++ != 0) return false; //only process 1 round
|
||||||
|
|
||||||
try{
|
try{
|
||||||
path = Paths.get(Utils.filer.createResource(StandardLocation.CLASS_OUTPUT, "no", "no")
|
path = Fi.get(Utils.filer.createResource(StandardLocation.CLASS_OUTPUT, "no", "no")
|
||||||
.toUri().toURL().toString().substring(System.getProperty("os.name").contains("Windows") ? 6 : "file:".length()))
|
.toUri().toURL().toString().substring(System.getProperty("os.name").contains("Windows") ? 6 : "file:".length()))
|
||||||
.getParent().getParent().getParent().getParent().getParent().getParent().toString();
|
.parent().parent().parent().parent().parent().parent().toString();
|
||||||
path = path.replace("%20", " ");
|
path = path.replace("%20", " ");
|
||||||
|
|
||||||
processSounds("Sounds", path + "/assets/sounds", "arc.audio.Sound");
|
processSounds("Sounds", path + "/assets/sounds", "arc.audio.Sound");
|
||||||
@@ -54,15 +57,28 @@ public class AssetsAnnotationProcessor extends AbstractProcessor{
|
|||||||
String[] iconSizes = {"small", "smaller", "tiny"};
|
String[] iconSizes = {"small", "smaller", "tiny"};
|
||||||
|
|
||||||
TypeSpec.Builder type = TypeSpec.classBuilder("Tex").addModifiers(Modifier.PUBLIC);
|
TypeSpec.Builder type = TypeSpec.classBuilder("Tex").addModifiers(Modifier.PUBLIC);
|
||||||
TypeSpec.Builder ictype = TypeSpec.classBuilder("Icon").addModifiers(Modifier.PUBLIC);
|
TypeSpec.Builder ictype = TypeSpec.classBuilder("Icon").addModifiers(Modifier.PUBLIC); //TODO remove and replace
|
||||||
|
TypeSpec.Builder ictype_ = TypeSpec.classBuilder("Icon_").addModifiers(Modifier.PUBLIC);
|
||||||
|
TypeSpec.Builder ichtype = TypeSpec.classBuilder("Iconc").addModifiers(Modifier.PUBLIC);
|
||||||
MethodSpec.Builder load = MethodSpec.methodBuilder("load").addModifiers(Modifier.PUBLIC, Modifier.STATIC);
|
MethodSpec.Builder load = MethodSpec.methodBuilder("load").addModifiers(Modifier.PUBLIC, Modifier.STATIC);
|
||||||
MethodSpec.Builder loadStyles = MethodSpec.methodBuilder("loadStyles").addModifiers(Modifier.PUBLIC, Modifier.STATIC);
|
MethodSpec.Builder loadStyles = MethodSpec.methodBuilder("loadStyles").addModifiers(Modifier.PUBLIC, Modifier.STATIC);
|
||||||
MethodSpec.Builder icload = MethodSpec.methodBuilder("load").addModifiers(Modifier.PUBLIC, Modifier.STATIC);
|
MethodSpec.Builder icload = MethodSpec.methodBuilder("load").addModifiers(Modifier.PUBLIC, Modifier.STATIC);
|
||||||
|
MethodSpec.Builder icload_ = MethodSpec.methodBuilder("load").addModifiers(Modifier.PUBLIC, Modifier.STATIC);
|
||||||
String resources = path + "/assets-raw/sprites/ui";
|
String resources = path + "/assets-raw/sprites/ui";
|
||||||
Files.walk(Paths.get(resources)).forEach(p -> {
|
Jval icons = Jval.read(Fi.get(path + "/assets-raw/fontgen/config.json").readString());
|
||||||
if(Files.isDirectory(p) || p.getFileName().toString().equals(".DS_Store")) return;
|
|
||||||
|
|
||||||
String filename = p.getFileName().toString();
|
for(Jval val : icons.get("glyphs").asArray()){
|
||||||
|
String name = capitalize(val.getString("css", ""));
|
||||||
|
int code = val.getInt("code", 0);
|
||||||
|
ichtype.addField(FieldSpec.builder(char.class, name, Modifier.PUBLIC, Modifier.STATIC, Modifier.FINAL).initializer("(char)" + code).build());
|
||||||
|
ictype_.addField(TextureRegionDrawable.class, name, Modifier.PUBLIC, Modifier.STATIC);
|
||||||
|
icload_.addStatement(name + " = mindustry.Vars.ui.getGlyph(mindustry.ui.Fonts.def, (char)" + code + ")");
|
||||||
|
}
|
||||||
|
|
||||||
|
Fi.get(resources).walk(p -> {
|
||||||
|
if(p.nameWithoutExtension().equals(".DS_Store")) return;
|
||||||
|
|
||||||
|
String filename = p.name();
|
||||||
filename = filename.substring(0, filename.indexOf("."));
|
filename = filename.substring(0, filename.indexOf("."));
|
||||||
|
|
||||||
ArrayList<String> names = new ArrayList<>();
|
ArrayList<String> names = new ArrayList<>();
|
||||||
@@ -75,7 +91,7 @@ public class AssetsAnnotationProcessor extends AbstractProcessor{
|
|||||||
suffix = suffix.isEmpty() ? "" : "-" + suffix;
|
suffix = suffix.isEmpty() ? "" : "-" + suffix;
|
||||||
|
|
||||||
String sfilen = filename + suffix;
|
String sfilen = filename + suffix;
|
||||||
String dtype = p.getFileName().toString().endsWith(".9.png") ? "arc.scene.style.NinePatchDrawable" : "arc.scene.style.TextureRegionDrawable";
|
String dtype = p.name().endsWith(".9.png") ? "arc.scene.style.NinePatchDrawable" : "arc.scene.style.TextureRegionDrawable";
|
||||||
|
|
||||||
String varname = capitalize(sfilen);
|
String varname = capitalize(sfilen);
|
||||||
TypeSpec.Builder ttype = type;
|
TypeSpec.Builder ttype = type;
|
||||||
@@ -96,8 +112,7 @@ public class AssetsAnnotationProcessor extends AbstractProcessor{
|
|||||||
});
|
});
|
||||||
|
|
||||||
for(Element elem : elements){
|
for(Element elem : elements){
|
||||||
TypeElement t = (TypeElement)elem;
|
Array.with(((TypeElement)elem).getEnclosedElements()).each(e -> e.getKind() == ElementKind.FIELD, field -> {
|
||||||
t.getEnclosedElements().stream().filter(e -> e.getKind() == ElementKind.FIELD).forEach(field -> {
|
|
||||||
String fname = field.getSimpleName().toString();
|
String fname = field.getSimpleName().toString();
|
||||||
if(fname.startsWith("default")){
|
if(fname.startsWith("default")){
|
||||||
loadStyles.addStatement("arc.Core.scene.addStyle(" + field.asType().toString() + ".class, mindustry.ui.Styles." + fname + ")");
|
loadStyles.addStatement("arc.Core.scene.addStyle(" + field.asType().toString() + ".class, mindustry.ui.Styles." + fname + ")");
|
||||||
@@ -106,7 +121,10 @@ public class AssetsAnnotationProcessor extends AbstractProcessor{
|
|||||||
}
|
}
|
||||||
|
|
||||||
ictype.addMethod(icload.build());
|
ictype.addMethod(icload.build());
|
||||||
|
ictype_.addMethod(icload_.build());
|
||||||
JavaFile.builder(packageName, ictype.build()).build().writeTo(Utils.filer);
|
JavaFile.builder(packageName, ictype.build()).build().writeTo(Utils.filer);
|
||||||
|
JavaFile.builder(packageName, ichtype.build()).build().writeTo(Utils.filer);
|
||||||
|
JavaFile.builder(packageName, ictype_.build()).build().writeTo(Utils.filer);
|
||||||
|
|
||||||
type.addMethod(load.build());
|
type.addMethod(load.build());
|
||||||
type.addMethod(loadStyles.build());
|
type.addMethod(loadStyles.build());
|
||||||
@@ -119,10 +137,9 @@ public class AssetsAnnotationProcessor extends AbstractProcessor{
|
|||||||
MethodSpec.Builder loadBegin = MethodSpec.methodBuilder("load").addModifiers(Modifier.PUBLIC, Modifier.STATIC);
|
MethodSpec.Builder loadBegin = MethodSpec.methodBuilder("load").addModifiers(Modifier.PUBLIC, Modifier.STATIC);
|
||||||
|
|
||||||
HashSet<String> names = new HashSet<>();
|
HashSet<String> names = new HashSet<>();
|
||||||
Files.list(Paths.get(path)).forEach(p -> {
|
Fi.get(path).walk(p -> {
|
||||||
String fname = p.getFileName().toString();
|
String fname = p.name();
|
||||||
String name = p.getFileName().toString();
|
String name = p.nameWithoutExtension();
|
||||||
name = name.substring(0, name.indexOf("."));
|
|
||||||
|
|
||||||
if(names.contains(name)){
|
if(names.contains(name)){
|
||||||
Utils.messager.printMessage(Kind.ERROR, "Duplicate file name: " + p.toString() + "!");
|
Utils.messager.printMessage(Kind.ERROR, "Duplicate file name: " + p.toString() + "!");
|
||||||
|
|||||||
@@ -299,7 +299,6 @@ project(":tools"){
|
|||||||
compile "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-desktop"
|
compile "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-desktop"
|
||||||
compile "com.badlogicgames.gdx:gdx-freetype-platform:$gdxVersion:natives-desktop"
|
compile "com.badlogicgames.gdx:gdx-freetype-platform:$gdxVersion:natives-desktop"
|
||||||
compile "org.reflections:reflections:0.9.11"
|
compile "org.reflections:reflections:0.9.11"
|
||||||
compile "org.apache.pdfbox:fontbox:2.0.0"
|
|
||||||
|
|
||||||
compile arcModule("backends:backend-sdl")
|
compile arcModule("backends:backend-sdl")
|
||||||
}
|
}
|
||||||
@@ -310,6 +309,7 @@ project(":annotations"){
|
|||||||
|
|
||||||
dependencies{
|
dependencies{
|
||||||
compile 'com.squareup:javapoet:1.11.0'
|
compile 'com.squareup:javapoet:1.11.0'
|
||||||
|
compile "com.github.Anuken.Arc:arc-core:-SNAPSHOT"
|
||||||
compile files("${System.getProperty('java.home')}/../lib/tools.jar")
|
compile files("${System.getProperty('java.home')}/../lib/tools.jar")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -62,7 +62,7 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"uid": "6f880cbd94039674f0de065ffb57c250",
|
"uid": "6f880cbd94039674f0de065ffb57c250",
|
||||||
"css": "icon-distribution-transparent.png",
|
"css": "icon-distribution-transparent",
|
||||||
"code": 59398,
|
"code": 59398,
|
||||||
"src": "custom_icons",
|
"src": "custom_icons",
|
||||||
"selected": true,
|
"selected": true,
|
||||||
|
|||||||
Binary file not shown.
File diff suppressed because it is too large
Load Diff
Binary file not shown.
|
Before Width: | Height: | Size: 924 KiB After Width: | Height: | Size: 905 KiB |
@@ -63,6 +63,7 @@ public abstract class ClientLauncher extends ApplicationCore implements Platform
|
|||||||
|
|
||||||
assets.load(new AssetDescriptor<>("sprites/sprites.atlas", TextureAtlas.class)).loaded = t -> {
|
assets.load(new AssetDescriptor<>("sprites/sprites.atlas", TextureAtlas.class)).loaded = t -> {
|
||||||
atlas = (TextureAtlas)t;
|
atlas = (TextureAtlas)t;
|
||||||
|
UI.cleanAtlas(atlas);
|
||||||
};
|
};
|
||||||
|
|
||||||
assets.loadRun("maps", Map.class, () -> maps.loadPreviews());
|
assets.loadRun("maps", Map.class, () -> maps.loadPreviews());
|
||||||
|
|||||||
@@ -7,24 +7,30 @@ import arc.Input.*;
|
|||||||
import arc.assets.*;
|
import arc.assets.*;
|
||||||
import arc.assets.loaders.*;
|
import arc.assets.loaders.*;
|
||||||
import arc.assets.loaders.resolvers.*;
|
import arc.assets.loaders.resolvers.*;
|
||||||
import arc.struct.*;
|
|
||||||
import arc.files.*;
|
import arc.files.*;
|
||||||
import arc.freetype.*;
|
import arc.freetype.*;
|
||||||
import arc.freetype.FreeTypeFontGenerator.*;
|
import arc.freetype.FreeTypeFontGenerator.*;
|
||||||
import arc.freetype.FreetypeFontLoader.*;
|
import arc.freetype.FreetypeFontLoader.*;
|
||||||
import arc.func.*;
|
import arc.func.*;
|
||||||
import arc.graphics.*;
|
import arc.graphics.*;
|
||||||
|
import arc.graphics.Pixmap.*;
|
||||||
import arc.graphics.Texture.*;
|
import arc.graphics.Texture.*;
|
||||||
import arc.graphics.g2d.*;
|
import arc.graphics.g2d.*;
|
||||||
|
import arc.graphics.g2d.BitmapFont.*;
|
||||||
|
import arc.graphics.g2d.PixmapPacker.*;
|
||||||
|
import arc.graphics.g2d.TextureAtlas.*;
|
||||||
import arc.input.*;
|
import arc.input.*;
|
||||||
import arc.math.*;
|
import arc.math.*;
|
||||||
|
import arc.math.geom.*;
|
||||||
import arc.scene.*;
|
import arc.scene.*;
|
||||||
import arc.scene.actions.*;
|
import arc.scene.actions.*;
|
||||||
import arc.scene.event.*;
|
import arc.scene.event.*;
|
||||||
|
import arc.scene.style.*;
|
||||||
import arc.scene.ui.*;
|
import arc.scene.ui.*;
|
||||||
import arc.scene.ui.TextField.*;
|
import arc.scene.ui.TextField.*;
|
||||||
import arc.scene.ui.Tooltip.*;
|
import arc.scene.ui.Tooltip.*;
|
||||||
import arc.scene.ui.layout.*;
|
import arc.scene.ui.layout.*;
|
||||||
|
import arc.struct.*;
|
||||||
import arc.util.*;
|
import arc.util.*;
|
||||||
import mindustry.core.GameState.*;
|
import mindustry.core.GameState.*;
|
||||||
import mindustry.editor.*;
|
import mindustry.editor.*;
|
||||||
@@ -39,6 +45,8 @@ import static arc.scene.actions.Actions.*;
|
|||||||
import static mindustry.Vars.*;
|
import static mindustry.Vars.*;
|
||||||
|
|
||||||
public class UI implements ApplicationListener, Loadable{
|
public class UI implements ApplicationListener, Loadable{
|
||||||
|
public static PixmapPacker packer;
|
||||||
|
|
||||||
public MenuFragment menufrag;
|
public MenuFragment menufrag;
|
||||||
public HudFragment hudfrag;
|
public HudFragment hudfrag;
|
||||||
public ChatFragment chatfrag;
|
public ChatFragment chatfrag;
|
||||||
@@ -97,6 +105,7 @@ public class UI implements ApplicationListener, Loadable{
|
|||||||
|
|
||||||
Tex.load();
|
Tex.load();
|
||||||
Icon.load();
|
Icon.load();
|
||||||
|
Icon_.load();
|
||||||
Styles.load();
|
Styles.load();
|
||||||
Tex.loadStyles();
|
Tex.loadStyles();
|
||||||
|
|
||||||
@@ -135,6 +144,7 @@ public class UI implements ApplicationListener, Loadable{
|
|||||||
|
|
||||||
/** Called from a static context for use in the loading screen.*/
|
/** Called from a static context for use in the loading screen.*/
|
||||||
public static void loadDefaultFont(){
|
public static void loadDefaultFont(){
|
||||||
|
packer = new PixmapPacker(2048, 2048, Format.RGBA8888, 2, true);
|
||||||
FileHandleResolver resolver = new InternalFileHandleResolver();
|
FileHandleResolver resolver = new InternalFileHandleResolver();
|
||||||
Core.assets.setLoader(FreeTypeFontGenerator.class, new FreeTypeFontGeneratorLoader(resolver));
|
Core.assets.setLoader(FreeTypeFontGenerator.class, new FreeTypeFontGeneratorLoader(resolver));
|
||||||
Core.assets.setLoader(BitmapFont.class, null, new FreetypeFontLoader(resolver){
|
Core.assets.setLoader(BitmapFont.class, null, new FreetypeFontLoader(resolver){
|
||||||
@@ -147,6 +157,7 @@ public class UI implements ApplicationListener, Loadable{
|
|||||||
parameter.fontParameters.magFilter = TextureFilter.Linear;
|
parameter.fontParameters.magFilter = TextureFilter.Linear;
|
||||||
parameter.fontParameters.minFilter = TextureFilter.Linear;
|
parameter.fontParameters.minFilter = TextureFilter.Linear;
|
||||||
parameter.fontParameters.size = fontParameter().size;
|
parameter.fontParameters.size = fontParameter().size;
|
||||||
|
parameter.fontParameters.packer = packer;
|
||||||
return super.loadSync(manager, fileName, file, parameter);
|
return super.loadSync(manager, fileName, file, parameter);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -159,11 +170,57 @@ public class UI implements ApplicationListener, Loadable{
|
|||||||
Core.assets.load("outline", BitmapFont.class, new FreeTypeFontLoaderParameter("fonts/font.ttf", param)).loaded = t -> Fonts.outline = (BitmapFont)t;
|
Core.assets.load("outline", BitmapFont.class, new FreeTypeFontLoaderParameter("fonts/font.ttf", param)).loaded = t -> Fonts.outline = (BitmapFont)t;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void cleanAtlas(TextureAtlas atlas){
|
||||||
|
//grab all textures from the ui page, remove all the regions assigned to it, then copy them over to Fonts.packer and replace the texture in this atlas.
|
||||||
|
|
||||||
|
//grab old UI texture and regions...
|
||||||
|
Texture texture = atlas.find("logo").getTexture();
|
||||||
|
|
||||||
|
Page page = packer.getPages().first();
|
||||||
|
|
||||||
|
Array<AtlasRegion> regions = atlas.getRegions().select(t -> t.getTexture() == texture);
|
||||||
|
for(AtlasRegion region : regions){
|
||||||
|
//get new pack rect
|
||||||
|
page.setDirty(false);
|
||||||
|
Rect rect = packer.pack(region.name + (region.splits != null ? ".9" : ""), atlas.getPixmap(region));
|
||||||
|
//set new texture
|
||||||
|
region.setTexture(packer.getPages().first().getTexture());
|
||||||
|
//set its new position
|
||||||
|
region.set((int)rect.x, (int)rect.y, (int)rect.width, (int)rect.height);
|
||||||
|
//add old texture
|
||||||
|
atlas.getTextures().add(region.getTexture());
|
||||||
|
}
|
||||||
|
|
||||||
|
//remove old texture, it will no longer be used
|
||||||
|
atlas.getTextures().remove(texture);
|
||||||
|
texture.dispose();
|
||||||
|
atlas.disposePixmap(texture);
|
||||||
|
|
||||||
|
page.setDirty(true);
|
||||||
|
page.updateTexture(TextureFilter.Linear, TextureFilter.Linear, false);
|
||||||
|
}
|
||||||
|
|
||||||
void loadExtraCursors(){
|
void loadExtraCursors(){
|
||||||
drillCursor = Core.graphics.newCursor("drill");
|
drillCursor = Core.graphics.newCursor("drill");
|
||||||
unloadCursor = Core.graphics.newCursor("unload");
|
unloadCursor = Core.graphics.newCursor("unload");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public TextureRegionDrawable getGlyph(BitmapFont font, char glyph){
|
||||||
|
Glyph g = font.getData().getGlyph(glyph);
|
||||||
|
if(g == null) throw new IllegalArgumentException("No glyph: " + glyph + " (" + (int)glyph + ")");
|
||||||
|
float aspect = (float)g.height / g.width;
|
||||||
|
TextureRegionDrawable draw = new TextureRegionDrawable(new TextureRegion(font.getRegion().getTexture(), g.u, g.v2, g.u2, g.v)){
|
||||||
|
@Override
|
||||||
|
public void draw(float x, float y, float width, float height){
|
||||||
|
//enforce even aspect ratio, which will always be incorrect for complicate reasons
|
||||||
|
super.draw(x, y, width, width * aspect);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
draw.setMinWidth(draw.getRegion().getWidth());
|
||||||
|
draw.setMinHeight(draw.getRegion().getHeight());
|
||||||
|
return draw;
|
||||||
|
}
|
||||||
|
|
||||||
public void setupFonts(){
|
public void setupFonts(){
|
||||||
String fontName = "fonts/font.ttf";
|
String fontName = "fonts/font.ttf";
|
||||||
|
|
||||||
@@ -271,7 +328,10 @@ public class UI implements ApplicationListener, Loadable{
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void dispose(){
|
public void dispose(){
|
||||||
//generator.dispose();
|
if(packer != null){
|
||||||
|
packer.dispose();
|
||||||
|
packer = null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void loadAnd(Runnable call){
|
public void loadAnd(Runnable call){
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ package mindustry.mod;
|
|||||||
|
|
||||||
import arc.*;
|
import arc.*;
|
||||||
import arc.files.*;
|
import arc.files.*;
|
||||||
|
import arc.struct.*;
|
||||||
import arc.util.*;
|
import arc.util.*;
|
||||||
import arc.util.Log.*;
|
import arc.util.Log.*;
|
||||||
import mindustry.*;
|
import mindustry.*;
|
||||||
@@ -9,6 +10,7 @@ import mindustry.mod.Mods.*;
|
|||||||
import org.mozilla.javascript.*;
|
import org.mozilla.javascript.*;
|
||||||
|
|
||||||
public class Scripts implements Disposable{
|
public class Scripts implements Disposable{
|
||||||
|
private final Array<String> blacklist = Array.with("net", "classaccess", ".io", "io.", "files", "reflect");
|
||||||
private final Context context;
|
private final Context context;
|
||||||
private final String wrapper;
|
private final String wrapper;
|
||||||
private Scriptable scope;
|
private Scriptable scope;
|
||||||
@@ -18,9 +20,7 @@ public class Scripts implements Disposable{
|
|||||||
Time.mark();
|
Time.mark();
|
||||||
|
|
||||||
context = Vars.platform.getScriptContext();
|
context = Vars.platform.getScriptContext();
|
||||||
context.setClassShutter(type -> (ClassAccess.allowedClassNames.contains(type) || type.startsWith("$Proxy") ||
|
context.setClassShutter(type -> !blacklist.contains(type.toLowerCase()::contains));
|
||||||
type.startsWith("adapter") || type.contains("PrintStream") ||
|
|
||||||
type.startsWith("mindustry")) && !type.equals("mindustry.mod.ClassAccess"));
|
|
||||||
context.getWrapFactory().setJavaPrimitiveWrap(false);
|
context.getWrapFactory().setJavaPrimitiveWrap(false);
|
||||||
|
|
||||||
scope = new ImporterTopLevel(context);
|
scope = new ImporterTopLevel(context);
|
||||||
|
|||||||
@@ -6,4 +6,5 @@ public class Fonts{
|
|||||||
public static BitmapFont def;
|
public static BitmapFont def;
|
||||||
public static BitmapFont outline;
|
public static BitmapFont outline;
|
||||||
public static BitmapFont chat;
|
public static BitmapFont chat;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,3 +1,3 @@
|
|||||||
org.gradle.daemon=true
|
org.gradle.daemon=true
|
||||||
org.gradle.jvmargs=-Xms256m -Xmx1024m
|
org.gradle.jvmargs=-Xms256m -Xmx1024m
|
||||||
archash=28ea91ea741417c01f0beb3b9dc320dc3f42ff25
|
archash=b77767039334b2658f44d69e72d1ef6bc84f95b0
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ import java.io.*;
|
|||||||
*/
|
*/
|
||||||
public class FontGenerator{
|
public class FontGenerator{
|
||||||
|
|
||||||
|
//E000 to F8FF
|
||||||
public static void main(String[] args){
|
public static void main(String[] args){
|
||||||
Net net = Core.net = new Net();
|
Net net = Core.net = new Net();
|
||||||
net.setBlock(true);
|
net.setBlock(true);
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ public class ScriptStubGenerator{
|
|||||||
public static void main(String[] args){
|
public static void main(String[] args){
|
||||||
String base = "mindustry";
|
String base = "mindustry";
|
||||||
Array<String> blacklist = Array.with("plugin", "mod", "net", "io", "tools");
|
Array<String> blacklist = Array.with("plugin", "mod", "net", "io", "tools");
|
||||||
Array<String> nameBlacklist = Array.with("ClientLauncher", "NetClient", "NetServer", "ClassAccess");
|
Array<String> nameBlacklist = Array.with("ClassAccess");
|
||||||
Array<Class<?>> whitelist = Array.with(Draw.class, Fill.class, Lines.class, Core.class, TextureAtlas.class, TextureRegion.class, Time.class, System.class, PrintStream.class,
|
Array<Class<?>> whitelist = Array.with(Draw.class, Fill.class, Lines.class, Core.class, TextureAtlas.class, TextureRegion.class, Time.class, System.class, PrintStream.class,
|
||||||
AtlasRegion.class, String.class, Mathf.class, Angles.class, Color.class, Runnable.class, Object.class, Icon.class, Tex.class,
|
AtlasRegion.class, String.class, Mathf.class, Angles.class, Color.class, Runnable.class, Object.class, Icon.class, Tex.class,
|
||||||
Sounds.class, Musics.class, Call.class, Texture.class, TextureData.class, Pixmap.class, I18NBundle.class, Interval.class, DataInput.class, DataOutput.class,
|
Sounds.class, Musics.class, Call.class, Texture.class, TextureData.class, Pixmap.class, I18NBundle.class, Interval.class, DataInput.class, DataOutput.class,
|
||||||
|
|||||||
@@ -1,48 +0,0 @@
|
|||||||
package mindustry.tools;
|
|
||||||
|
|
||||||
import arc.*;
|
|
||||||
import arc.backend.sdl.*;
|
|
||||||
import arc.files.*;
|
|
||||||
import arc.graphics.*;
|
|
||||||
import arc.graphics.g2d.*;
|
|
||||||
import arc.util.*;
|
|
||||||
import mindustry.ui.*;
|
|
||||||
|
|
||||||
//TODO remove
|
|
||||||
public class Upscaler{
|
|
||||||
public static void main(String[] args){
|
|
||||||
new SdlApplication(new ApplicationListener(){
|
|
||||||
@Override
|
|
||||||
public void init(){
|
|
||||||
scale();
|
|
||||||
}
|
|
||||||
}, new SdlConfig(){{
|
|
||||||
initialVisible = false;
|
|
||||||
}});
|
|
||||||
}
|
|
||||||
|
|
||||||
static void scale(){
|
|
||||||
Core.batch = new SpriteBatch();
|
|
||||||
Core.atlas = new TextureAtlas();
|
|
||||||
Core.atlas.addRegion("white", Pixmaps.blankTextureRegion());
|
|
||||||
Fi file = Core.files.local("");
|
|
||||||
|
|
||||||
Log.info("Upscaling icons...");
|
|
||||||
Time.mark();
|
|
||||||
Fi[] list = file.list();
|
|
||||||
|
|
||||||
for(IconSize size : IconSize.values()){
|
|
||||||
String suffix = size == IconSize.def ? "" : "-" + size.name();
|
|
||||||
SquareMarcher marcher = new SquareMarcher(size.size);
|
|
||||||
|
|
||||||
for(Fi img : list){
|
|
||||||
if(img.extension().equals("png")){
|
|
||||||
marcher.render(new Pixmap(img), img.sibling(img.nameWithoutExtension() + suffix + ".png"));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Log.info("Done upscaling icons in &lm{0}&lgs.", Time.elapsed()/1000f);
|
|
||||||
Core.app.exit();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user