Fixed performance regression / Removed useless fallback sprites

This commit is contained in:
Anuken
2019-07-03 17:07:22 -04:00
parent d3c8678f80
commit 0d39400f8b
39 changed files with 5350 additions and 18146 deletions

View File

@@ -2,7 +2,6 @@ package io.anuke.mindustry.core;
import io.anuke.arc.*;
import io.anuke.arc.graphics.Color;
import io.anuke.arc.graphics.GL20;
import io.anuke.arc.graphics.g2d.Draw;
import io.anuke.arc.graphics.g2d.TextureAtlas;
import io.anuke.arc.input.KeyCode;
@@ -23,7 +22,6 @@ import io.anuke.mindustry.ui.dialogs.FloatingDialog;
import io.anuke.mindustry.world.Tile;
import java.io.IOException;
import java.nio.IntBuffer;
import static io.anuke.arc.Core.scene;
import static io.anuke.mindustry.Vars.*;
@@ -43,10 +41,6 @@ public class Control implements ApplicationListener{
private InputHandler input;
public Control(){
IntBuffer buf = BufferUtils.newIntBuffer(1);
Core.gl.glGetIntegerv(GL20.GL_MAX_TEXTURE_SIZE, buf);
int maxSize = buf.get(0);
saves = new Saves();
data = new GlobalData();
@@ -55,7 +49,7 @@ public class Control implements ApplicationListener{
Effects.setShakeFalloff(10000f);
content.initialize(Content::init);
Core.atlas = new TextureAtlas(maxSize < 2048 ? "sprites/sprites_fallback.atlas" : "sprites/sprites.atlas");
Core.atlas = new TextureAtlas("sprites/sprites.atlas");
Draw.scl = 1f / Core.atlas.find("scale_marker").getWidth();
content.initialize(Content::load, true);

View File

@@ -511,7 +511,7 @@ public class MapEditorDialog extends Dialog implements Disposable{
int i = 0;
for(Team team : Team.all){
ImageButton button = new ImageButton("white", "clear-toggle-partial");
ImageButton button = new ImageButton("whiteui", "clear-toggle-partial");
button.margin(4f);
button.getImageCell().grow();
button.getStyle().imageUpColor = team.color;
@@ -636,7 +636,7 @@ public class MapEditorDialog extends Dialog implements Disposable{
if(!Core.atlas.isFound(region)) continue;
ImageButton button = new ImageButton("white", "clear-toggle");
ImageButton button = new ImageButton("whiteui", "clear-toggle");
button.getStyle().imageUp = new TextureRegionDrawable(region);
button.clicked(() -> editor.drawBlock = block);
button.resizeImage(8 * 4f);

View File

@@ -21,7 +21,7 @@ public class Shapes{
Draw.rect(edge, x, y, edge.getWidth() * scale * Draw.scl, edge.getHeight() * scale * Draw.scl, rotation + 180);
Draw.rect(edge, x2, y2, edge.getWidth() * scale * Draw.scl, edge.getHeight() * scale * Draw.scl, rotation);
Lines.stroke(10f * scale);
Lines.stroke(12f * scale);
Lines.line(line, x + Tmp.v1.x, y + Tmp.v1.y, x2 - Tmp.v1.x, y2 - Tmp.v1.y, CapStyle.none, 0f);
Lines.stroke(1f);
}

View File

@@ -25,7 +25,7 @@ public class ContentDisplay{
table.row();
table.addImage("white").height(3).color(Color.LIGHT_GRAY).pad(8).padLeft(0).padRight(0).fillX();
table.addImage("whiteui").height(3).color(Color.LIGHT_GRAY).pad(8).padLeft(0).padRight(0).fillX();
table.row();
@@ -33,7 +33,7 @@ public class ContentDisplay{
table.add(block.description).padLeft(5).padRight(5).width(400f).wrap().fillX();
table.row();
table.addImage("white").height(3).color(Color.LIGHT_GRAY).pad(8).padLeft(0).padRight(0).fillX();
table.addImage("whiteui").height(3).color(Color.LIGHT_GRAY).pad(8).padLeft(0).padRight(0).fillX();
table.row();
}
@@ -73,7 +73,7 @@ public class ContentDisplay{
table.row();
table.addImage("white").height(3).color(Color.LIGHT_GRAY).pad(15).padLeft(0).padRight(0).fillX();
table.addImage("whiteui").height(3).color(Color.LIGHT_GRAY).pad(15).padLeft(0).padRight(0).fillX();
table.row();
@@ -81,7 +81,7 @@ public class ContentDisplay{
table.add(item.description).padLeft(5).padRight(5).width(400f).wrap().fillX();
table.row();
table.addImage("white").height(3).color(Color.LIGHT_GRAY).pad(15).padLeft(0).padRight(0).fillX();
table.addImage("whiteui").height(3).color(Color.LIGHT_GRAY).pad(15).padLeft(0).padRight(0).fillX();
table.row();
}
@@ -104,7 +104,7 @@ public class ContentDisplay{
table.row();
table.addImage("white").height(3).color(Color.LIGHT_GRAY).pad(15).padLeft(0).padRight(0).fillX();
table.addImage("whiteui").height(3).color(Color.LIGHT_GRAY).pad(15).padLeft(0).padRight(0).fillX();
table.row();
@@ -112,7 +112,7 @@ public class ContentDisplay{
table.add(liquid.description).padLeft(5).padRight(5).width(400f).wrap().fillX();
table.row();
table.addImage("white").height(3).color(Color.LIGHT_GRAY).pad(15).padLeft(0).padRight(0).fillX();
table.addImage("whiteui").height(3).color(Color.LIGHT_GRAY).pad(15).padLeft(0).padRight(0).fillX();
table.row();
}
@@ -139,7 +139,7 @@ public class ContentDisplay{
table.row();
table.addImage("white").height(3).color(Color.LIGHT_GRAY).pad(15).padLeft(0).padRight(0).fillX();
table.addImage("whiteui").height(3).color(Color.LIGHT_GRAY).pad(15).padLeft(0).padRight(0).fillX();
table.row();
@@ -147,7 +147,7 @@ public class ContentDisplay{
table.add(mech.description).padLeft(5).padRight(5).width(400f).wrap().fillX();
table.row();
table.addImage("white").height(3).color(Color.LIGHT_GRAY).pad(15).padLeft(0).padRight(0).fillX();
table.addImage("whiteui").height(3).color(Color.LIGHT_GRAY).pad(15).padLeft(0).padRight(0).fillX();
table.row();
}
@@ -186,7 +186,7 @@ public class ContentDisplay{
table.row();
table.addImage("white").height(3).color(Color.LIGHT_GRAY).pad(15).padLeft(0).padRight(0).fillX();
table.addImage("whiteui").height(3).color(Color.LIGHT_GRAY).pad(15).padLeft(0).padRight(0).fillX();
table.row();
@@ -194,7 +194,7 @@ public class ContentDisplay{
table.add(unit.description).padLeft(5).padRight(5).width(400f).wrap().fillX();
table.row();
table.addImage("white").height(3).color(Color.LIGHT_GRAY).pad(15).padLeft(0).padRight(0).fillX();
table.addImage("whiteui").height(3).color(Color.LIGHT_GRAY).pad(15).padLeft(0).padRight(0).fillX();
table.row();
}

View File

@@ -46,9 +46,9 @@ public class AboutDialog extends FloatingDialog{
Table table = new Table("underline");
table.margin(0);
table.table(img -> {
img.addImage("white").height(h - 5).width(40f).color(link.color);
img.addImage("whiteui").height(h - 5).width(40f).color(link.color);
img.row();
img.addImage("white").height(5).width(40f).color(link.color.cpy().mul(0.8f, 0.8f, 0.8f, 1f));
img.addImage("whiteui").height(5).width(40f).color(link.color.cpy().mul(0.8f, 0.8f, 0.8f, 1f));
}).expandY();
table.table(i -> {

View File

@@ -25,7 +25,7 @@ public class ColorPickDialog extends Dialog{
for(int i = 0; i < playerColors.length; i++){
Color color = playerColors[i];
ImageButton button = table.addImageButton("white", "clear-toggle", 34, () -> {
ImageButton button = table.addImageButton("whiteui", "clear-toggle", 34, () -> {
cons.accept(color);
hide();
}).size(48).get();

View File

@@ -15,7 +15,7 @@ public class ControlsDialog extends KeybindDialog{
setFillParent(true);
title.setAlignment(Align.center);
titleTable.row();
titleTable.add(new Image("white"))
titleTable.add(new Image("whiteui"))
.growX().height(3f).pad(4f).get().setColor(Pal.accent);
}

View File

@@ -40,7 +40,7 @@ public class DatabaseDialog extends FloatingDialog{
table.add("$content." + type.name() + ".name").growX().left().color(Pal.accent);
table.row();
table.addImage("white").growX().pad(5).padLeft(0).padRight(0).height(3).color(Pal.accent);
table.addImage("whiteui").growX().pad(5).padLeft(0).padRight(0).height(3).color(Pal.accent);
table.row();
table.table(list -> {
list.left();

View File

@@ -22,9 +22,9 @@ public class DiscordDialog extends Dialog{
t.background("button").margin(0);
t.table(img -> {
img.addImage("white").height(h - 5).width(40f).color(color);
img.addImage("whiteui").height(h - 5).width(40f).color(color);
img.row();
img.addImage("white").height(5).width(40f).color(color.cpy().mul(0.8f, 0.8f, 0.8f, 1f));
img.addImage("whiteui").height(5).width(40f).color(color.cpy().mul(0.8f, 0.8f, 0.8f, 1f));
}).expandY();
t.table(i -> {

View File

@@ -23,7 +23,7 @@ public class FloatingDialog extends Dialog{
setFillParent(true);
this.title.setAlignment(Align.center);
titleTable.row();
titleTable.addImage("white", Pal.accent)
titleTable.addImage("whiteui", Pal.accent)
.growX().height(3f).pad(4f);
hidden(() -> {

View File

@@ -30,7 +30,7 @@ public class HostDialog extends FloatingDialog{
ui.listfrag.rebuild();
}).grow().pad(8).get().setMaxLength(40);
ImageButton button = t.addImageButton("white", "clear-full", 40, () -> {
ImageButton button = t.addImageButton("whiteui", "clear-full", 40, () -> {
new ColorPickDialog().show(color -> {
player.color.set(color);
Core.settings.put("color-0", Color.rgba8888(color));

View File

@@ -223,7 +223,7 @@ public class JoinDialog extends FloatingDialog{
Core.settings.save();
}).grow().pad(8).get().setMaxLength(maxNameLength);
ImageButton button = t.addImageButton("white", "clear-full", 40, () -> {
ImageButton button = t.addImageButton("whiteui", "clear-full", 40, () -> {
new ColorPickDialog().show(color -> {
player.color.set(color);
Core.settings.put("color-0", Color.rgba8888(color));

View File

@@ -94,7 +94,7 @@ public class MapsDialog extends FloatingDialog{
button.margin(9);
button.add(map.name()).width(mapsize - 18f).center().get().setEllipsis(true);
button.row();
button.addImage("white").growX().pad(4).color(Color.GRAY);
button.addImage("whiteui").growX().pad(4).color(Color.GRAY);
button.row();
button.stack(new Image(map.texture).setScaling(Scaling.fit), new BorderImage(map.texture).setScaling(Scaling.fit)).size(mapsize - 20f);
button.row();

View File

@@ -48,7 +48,7 @@ public class SettingsMenuDialog extends SettingsDialog{
setFillParent(true);
title.setAlignment(Align.center);
titleTable.row();
titleTable.add(new Image("white")).growX().height(3f).pad(4f).get().setColor(Pal.accent);
titleTable.add(new Image("whiteui")).growX().height(3f).pad(4f).get().setColor(Pal.accent);
cont.clearChildren();
cont.remove();

View File

@@ -101,7 +101,7 @@ public class ZoneInfoDialog extends FloatingDialog{
}else{
cont.add(zone.localizedName()).color(Pal.accent).growX().center();
cont.row();
cont.addImage("white").color(Pal.accent).height(3).pad(6).growX();
cont.addImage("whiteui").color(Pal.accent).height(3).pad(6).growX();
cont.row();
cont.addButton(zone.canConfigure() ? "$configure" : Core.bundle.format("configure.locked", zone.configureWave), () -> loadout.show(zone, rebuildItems)).fillX().pad(3).disabled(b -> !zone.canConfigure());
cont.row();

View File

@@ -532,7 +532,7 @@ public class HudFragment extends Fragment{
}
public void showLaunch(){
Image image = new Image("white");
Image image = new Image("whiteui");
image.getColor().a = 0f;
image.setFillParent(true);
image.actions(Actions.fadeIn(40f / 60f));

View File

@@ -18,11 +18,11 @@ public class LoadingFragment extends Fragment{
t.touchable(Touchable.enabled);
t.add().height(70f).row();
t.addImage("white").growX().height(3f).pad(4f).growX().get().setColor(Pal.accent);
t.addImage("whiteui").growX().height(3f).pad(4f).growX().get().setColor(Pal.accent);
t.row();
t.add("$loading").name("namelabel").pad(10f);
t.row();
t.addImage("white").growX().height(3f).pad(4f).growX().get().setColor(Pal.accent);
t.addImage("whiteui").growX().height(3f).pad(4f).growX().get().setColor(Pal.accent);
t.row();
button = t.addButton("$cancel", () -> {

View File

@@ -28,7 +28,7 @@ public class ItemSelection{
for(Item item : items){
if(!data.isUnlocked(item) && world.isZone()) continue;
ImageButton button = cont.addImageButton("white", "clear-toggle", 24, () -> control.input().frag.config.hideConfig()).group(group).get();
ImageButton button = cont.addImageButton("whiteui", "clear-toggle", 24, () -> control.input().frag.config.hideConfig()).group(group).get();
button.changed(() -> consumer.accept(button.isChecked() ? item : null));
button.getStyle().imageUp = new TextureRegionDrawable(item.icon(Icon.medium));
button.update(() -> button.setChecked(holder.get() == item));

View File

@@ -211,7 +211,7 @@ public class PowerNode extends PowerBlock{
for(int i = 0; i < entity.power.links.size; i++){
Tile link = world.tile(entity.power.links.get(i));
if(link != null && (link.pos() < tile.pos() || !Core.camera.bounds(Tmp.r1).contains(tile.drawx(), tile.drawy()))){
if(link != null && (link.pos() < tile.pos() || !(link.block() instanceof PowerNode) || !Core.camera.bounds(Tmp.r1).contains(link.drawx(), link.drawy()))){
drawLaser(tile, link);
}
}
@@ -257,13 +257,8 @@ public class PowerNode extends PowerBlock{
y2 -= t1.y;
Draw.color(Pal.powerLight, Color.WHITE, Mathf.absin(Time.time(), 8f, 0.3f) + 0.2f);
//Lines.stroke(2f);
//Lines.line(x1, y1, x2, y2);
Lines.stroke(1f);
Lines.line(x1, y1, x2, y2);
Draw.reset();
//Shapes.laser(laser, laserEnd, x1, y1, x2, y2, 0.6f);
Shapes.laser(laser, laserEnd, x1, y1, x2, y2, 0.6f);
Draw.color();
}
}