Misc. cleanup of UI / Removed 'font scale' var / Removed [orange]
This commit is contained in:
@@ -86,8 +86,6 @@ public class Vars{
|
||||
public static FileHandle saveDirectory;
|
||||
public static String mapExtension = "mmap";
|
||||
public static String saveExtension = "msav";
|
||||
//scale of the font
|
||||
public static float fontScale;
|
||||
//camera zoom displayed on startup
|
||||
public static int baseCameraScale;
|
||||
public static boolean showBlockDebug = false;
|
||||
@@ -173,8 +171,6 @@ public class Vars{
|
||||
dataDirectory = OS.getAppDataDirectory(appName);
|
||||
customMapDirectory = dataDirectory.child("maps/");
|
||||
saveDirectory = dataDirectory.child("saves/");
|
||||
|
||||
fontScale = Math.max(Unit.dp.scl(1f), 0.5f);
|
||||
baseCameraScale = Math.round(Unit.dp.scl(4));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -321,7 +321,7 @@ public class Control extends Module{
|
||||
if(!Settings.getBool("4.0-warning-2", false)){
|
||||
|
||||
Timers.run(5f, () -> {
|
||||
FloatingDialog dialog = new FloatingDialog("[orange]WARNING![]");
|
||||
FloatingDialog dialog = new FloatingDialog("[accent]WARNING![]");
|
||||
dialog.buttons().addButton("$text.ok", () -> {
|
||||
dialog.hide();
|
||||
Settings.putBool("4.0-warning-2", true);
|
||||
|
||||
@@ -9,7 +9,6 @@ import com.badlogic.gdx.graphics.g2d.freetype.FreeTypeFontGenerator;
|
||||
import com.badlogic.gdx.graphics.g2d.freetype.FreeTypeFontGenerator.FreeTypeFontParameter;
|
||||
import com.badlogic.gdx.math.Interpolation;
|
||||
import com.badlogic.gdx.utils.Align;
|
||||
import io.anuke.mindustry.Vars;
|
||||
import io.anuke.mindustry.editor.MapEditorDialog;
|
||||
import io.anuke.mindustry.game.EventType.ResizeEvent;
|
||||
import io.anuke.mindustry.graphics.Palette;
|
||||
@@ -98,7 +97,7 @@ public class UI extends SceneModule{
|
||||
void generateFonts(){
|
||||
generator = new FreeTypeFontGenerator(Gdx.files.internal("fonts/pixel.ttf"));
|
||||
FreeTypeFontParameter param = new FreeTypeFontParameter();
|
||||
param.size = 14*2;
|
||||
param.size = (int)(14*2 * Math.max(Unit.dp.scl(1f), 0.5f));
|
||||
param.shadowColor = Color.DARK_GRAY;
|
||||
param.shadowOffsetY = 2;
|
||||
param.incremental = true;
|
||||
@@ -117,7 +116,7 @@ public class UI extends SceneModule{
|
||||
|
||||
for(BitmapFont font : skin.getAll(BitmapFont.class).values()){
|
||||
font.setUseIntegerPositions(true);
|
||||
font.getData().setScale(Vars.fontScale);
|
||||
//font.getData().setScale(Vars.fontScale);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -395,23 +395,28 @@ public class Player extends Unit implements BuilderTrait, CarryTrait, ShooterTra
|
||||
public void drawName(){
|
||||
GlyphLayout layout = Pooling.obtain(GlyphLayout.class, GlyphLayout::new);
|
||||
|
||||
Draw.tscl(0.25f / 2);
|
||||
boolean ints = Core.font.usesIntegerPositions();
|
||||
Core.font.setUseIntegerPositions(false);
|
||||
Draw.tscl(0.25f / io.anuke.ucore.scene.ui.layout.Unit.dp.scl(1f));
|
||||
layout.setText(Core.font, name);
|
||||
Draw.color(0f, 0f, 0f, 0.3f);
|
||||
Draw.rect("blank", x, y + 8 - layout.height / 2, layout.width + 2, layout.height + 2);
|
||||
Draw.rect("blank", x, y + 8 - layout.height / 2, layout.width + 2, layout.height + 3);
|
||||
Draw.color();
|
||||
Draw.tcolor(color);
|
||||
Draw.text(name, x, y + 8);
|
||||
|
||||
if(isAdmin){
|
||||
Draw.color(color);
|
||||
float s = 3f;
|
||||
Draw.color(color.r * 0.5f, color.g * 0.5f, color.b * 0.5f, 1f);
|
||||
Draw.rect("icon-admin-small", x + layout.width / 2f + 2 + 1, y + 6.5f, s, s);
|
||||
Draw.color(color);
|
||||
Draw.rect("icon-admin-small", x + layout.width / 2f + 2 + 1, y + 7f, s, s);
|
||||
}
|
||||
|
||||
Draw.reset();
|
||||
Pooling.free(layout);
|
||||
Draw.tscl(fontScale);
|
||||
Draw.tscl(1f);
|
||||
Core.font.setUseIntegerPositions(ints);
|
||||
}
|
||||
|
||||
/**Draw all current build requests. Does not draw the beam effect, only the positions.*/
|
||||
|
||||
@@ -2,7 +2,6 @@ package io.anuke.mindustry.entities.effect;
|
||||
|
||||
import com.badlogic.gdx.graphics.Color;
|
||||
import com.badlogic.gdx.math.Rectangle;
|
||||
import com.badlogic.gdx.math.Vector2;
|
||||
import com.badlogic.gdx.utils.Array;
|
||||
import com.badlogic.gdx.utils.IntSet;
|
||||
import io.anuke.annotations.Annotations.Loc;
|
||||
@@ -15,7 +14,6 @@ import io.anuke.mindustry.entities.traits.SyncTrait;
|
||||
import io.anuke.mindustry.game.Team;
|
||||
import io.anuke.mindustry.gen.Call;
|
||||
import io.anuke.mindustry.graphics.Palette;
|
||||
import io.anuke.ucore.core.Effects.Effect;
|
||||
import io.anuke.ucore.entities.EntityGroup;
|
||||
import io.anuke.ucore.entities.impl.TimedEntity;
|
||||
import io.anuke.ucore.entities.trait.DrawTrait;
|
||||
@@ -29,7 +27,6 @@ import java.io.DataInput;
|
||||
import java.io.DataOutput;
|
||||
|
||||
import static io.anuke.mindustry.Vars.bulletGroup;
|
||||
import static io.anuke.mindustry.Vars.fontScale;
|
||||
|
||||
public class Lightning extends TimedEntity implements DrawTrait, SyncTrait, TimeTrait{
|
||||
public static final float lifetime = 10f;
|
||||
|
||||
@@ -109,7 +109,7 @@ public class OverlayRenderer{
|
||||
Draw.color(0f, 0f, 0f, 0.5f);
|
||||
Fill.rect(target.drawx(), target.drawy(), v.x, v.y);
|
||||
Draw.textc(result.toString(), target.drawx(), target.drawy(), v);
|
||||
Draw.tscl(fontScale);
|
||||
Draw.tscl(1f);
|
||||
Draw.reset();
|
||||
}
|
||||
|
||||
|
||||
@@ -1,22 +1,16 @@
|
||||
package io.anuke.mindustry.ui;
|
||||
|
||||
import com.badlogic.gdx.graphics.Color;
|
||||
import com.badlogic.gdx.graphics.g2d.TextureRegion;
|
||||
import io.anuke.mindustry.type.ItemStack;
|
||||
import io.anuke.ucore.core.Core;
|
||||
import io.anuke.ucore.function.Supplier;
|
||||
import io.anuke.ucore.scene.ui.Image;
|
||||
import io.anuke.ucore.scene.ui.layout.Stack;
|
||||
import io.anuke.ucore.scene.ui.layout.Table;
|
||||
import io.anuke.ucore.scene.ui.layout.Unit;
|
||||
|
||||
public class ItemImage extends Stack{
|
||||
|
||||
public ItemImage(TextureRegion region, Supplier<CharSequence> text){
|
||||
Table t = new Table().left().bottom();
|
||||
|
||||
t.label(text).color(Color.DARK_GRAY).padBottom(-Core.skin.font().getData().capHeight * 2 / Unit.dp.scl(1f));
|
||||
t.row();
|
||||
t.label(text);
|
||||
|
||||
add(new Image(region));
|
||||
@@ -25,9 +19,6 @@ public class ItemImage extends Stack{
|
||||
|
||||
public ItemImage(ItemStack stack){
|
||||
Table t = new Table().left().bottom();
|
||||
|
||||
t.add(stack.amount + "").color(Color.DARK_GRAY).padBottom(-Core.skin.font().getData().capHeight * 2 / Unit.dp.scl(1f));
|
||||
t.row();
|
||||
t.add(stack.amount + "");
|
||||
|
||||
add(new Image(stack.item.region));
|
||||
|
||||
@@ -38,7 +38,7 @@ public class LanguageDialog extends FloatingDialog{
|
||||
Log.info("Setting locale: {0}", loc.toString());
|
||||
ui.showInfo("$text.language.restart");
|
||||
});
|
||||
langs.add(button).group(group).update(t -> t.setChecked(loc.equals(getLocale()))).size(400f, 60f).row();
|
||||
langs.add(button).group(group).update(t -> t.setChecked(loc.equals(getLocale()))).size(400f, 50f).row();
|
||||
}
|
||||
|
||||
content().add(pane);
|
||||
|
||||
@@ -116,7 +116,7 @@ public class PausedDialog extends FloatingDialog{
|
||||
control.saves.getCurrent().save();
|
||||
}catch(Throwable e){
|
||||
e.printStackTrace();
|
||||
threads.runGraphics(() -> ui.showError("[orange]" + Bundles.get("text.savefail")));
|
||||
threads.runGraphics(() -> ui.showError("[accent]" + Bundles.get("text.savefail")));
|
||||
}
|
||||
state.set(State.menu);
|
||||
});
|
||||
|
||||
@@ -53,7 +53,7 @@ public class SaveDialog extends LoadDialog{
|
||||
}catch(Throwable e){
|
||||
e.printStackTrace();
|
||||
|
||||
ui.showError("[orange]" + Bundles.get("text.savefail"));
|
||||
ui.showError("[accent]" + Bundles.get("text.savefail"));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -37,7 +37,7 @@ public class SectorsDialog extends FloatingDialog{
|
||||
table = new Table(){
|
||||
@Override
|
||||
public float getPrefWidth(){
|
||||
return Unit.dp.scl(sectorSize*2f);
|
||||
return sectorSize*2f;
|
||||
}
|
||||
};
|
||||
table.visible(() -> selected != null);
|
||||
@@ -101,7 +101,7 @@ public class SectorsDialog extends FloatingDialog{
|
||||
Cell<?> cell = t.addImageTextButton(sector.hasSave() ? "$text.sector.resume" : "$text.sector.deploy", "icon-play", 10*3, () -> {
|
||||
hide();
|
||||
Vars.ui.loadLogic(() -> world.sectors.playSector(selected));
|
||||
}).height(60f).growX();
|
||||
}).height(60f);
|
||||
|
||||
if(selected.hasSave()){
|
||||
t.addImageTextButton("$text.sector.abandon", "icon-cancel", 16 * 2, () ->
|
||||
@@ -109,9 +109,11 @@ public class SectorsDialog extends FloatingDialog{
|
||||
world.sectors.abandonSector(selected);
|
||||
// Simulate a sector selection so the buttons get updated.
|
||||
selectSector(selected);
|
||||
})
|
||||
).width(sectorSize).height(60f);
|
||||
cell.width(sectorSize);
|
||||
})
|
||||
).width(sectorSize / Unit.dp.scl(1f)).height(60f);
|
||||
cell.width(sectorSize / Unit.dp.scl(1f));
|
||||
}else{
|
||||
cell.width(sectorSize*2f / Unit.dp.scl(1f));
|
||||
}
|
||||
}).pad(-5).growX().padTop(0);
|
||||
|
||||
|
||||
@@ -323,7 +323,7 @@ public class BlocksFragment extends Fragment{
|
||||
if(core == null || state.mode.infiniteResources) return "*/*";
|
||||
|
||||
int amount = core.items.get(stack.item);
|
||||
String color = (amount < stack.amount / 2f ? "[red]" : amount < stack.amount ? "[orange]" : "[white]");
|
||||
String color = (amount < stack.amount / 2f ? "[red]" : amount < stack.amount ? "[accent]" : "[white]");
|
||||
|
||||
return color + format(amount) + "[white]/" + stack.amount;
|
||||
});
|
||||
|
||||
@@ -142,7 +142,7 @@ public class HudFragment extends Fragment{
|
||||
//paused table
|
||||
parent.fill(t -> {
|
||||
t.top().visible(() -> state.is(State.paused) && !Net.active());
|
||||
t.table("clear", top -> top.add("$text.paused").pad(6).get().setFontScale(fontScale * 1.5f));
|
||||
t.table("clear", top -> top.add("$text.paused").pad(6).get().setFontScale(1.5f));
|
||||
});
|
||||
|
||||
parent.fill(t -> {
|
||||
|
||||
@@ -32,12 +32,12 @@ public class MenuFragment extends Fragment{
|
||||
});
|
||||
|
||||
//discord icon in top right
|
||||
parent.fill(c -> c.top().right().addButton("", "discord", ui.discord::show).size(81, 42)
|
||||
parent.fill(c -> c.top().right().addButton("", "discord", ui.discord::show).size(84, 45)
|
||||
.visible(() -> state.is(State.menu)));
|
||||
|
||||
//info icon
|
||||
if(mobile){
|
||||
parent.fill(c -> c.top().left().addButton("", "info", ui.about::show).size(81, 42)
|
||||
parent.fill(c -> c.top().left().addButton("", "info", ui.about::show).size(84, 45)
|
||||
.visible(() -> state.is(State.menu)));
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user