Misc. in-game UI polish

This commit is contained in:
Anuken
2019-08-01 20:49:03 -04:00
parent f388ca298e
commit 8b3995686f
23 changed files with 256 additions and 230 deletions

View File

@@ -1501,11 +1501,11 @@ public class Blocks implements ContentList{
for(int i = 0; i < 7; i++){
Tmp.v1.trns(b.rot(), i * 8f);
float sl = Mathf.clamp(b.fout() - 0.5f) * (80f - i * 10);
Shapes.tri(b.x + Tmp.v1.x, b.y + Tmp.v1.y, 4f, sl, b.rot() + 90);
Shapes.tri(b.x + Tmp.v1.x, b.y + Tmp.v1.y, 4f, sl, b.rot() - 90);
Drawf.tri(b.x + Tmp.v1.x, b.y + Tmp.v1.y, 4f, sl, b.rot() + 90);
Drawf.tri(b.x + Tmp.v1.x, b.y + Tmp.v1.y, 4f, sl, b.rot() - 90);
}
Shapes.tri(b.x, b.y, 20f * b.fout(), (rayLength + 50), b.rot());
Shapes.tri(b.x, b.y, 20f * b.fout(), 10f, b.rot() + 180f);
Drawf.tri(b.x, b.y, 20f * b.fout(), (rayLength + 50), b.rot());
Drawf.tri(b.x, b.y, 20f * b.fout(), 10f, b.rot() + 180f);
Draw.reset();
}
});

View File

@@ -11,7 +11,7 @@ import io.anuke.mindustry.entities.effect.GroundEffectEntity.GroundEffect;
import io.anuke.mindustry.entities.type.BaseUnit;
import io.anuke.mindustry.game.ContentList;
import io.anuke.mindustry.graphics.Pal;
import io.anuke.mindustry.graphics.Shapes;
import io.anuke.mindustry.graphics.Drawf;
import io.anuke.mindustry.type.Item;
import io.anuke.mindustry.type.Item.Icon;
@@ -672,16 +672,16 @@ public class Fx implements ContentList{
shootSmall = new Effect(8, e -> {
Draw.color(Pal.lighterOrange, Pal.lightOrange, e.fin());
float w = 1f + 5 * e.fout();
Shapes.tri(e.x, e.y, w, 15f * e.fout(), e.rotation);
Shapes.tri(e.x, e.y, w, 3f * e.fout(), e.rotation + 180f);
Drawf.tri(e.x, e.y, w, 15f * e.fout(), e.rotation);
Drawf.tri(e.x, e.y, w, 3f * e.fout(), e.rotation + 180f);
Draw.reset();
});
shootHeal = new Effect(8, e -> {
Draw.color(Pal.heal);
float w = 1f + 5 * e.fout();
Shapes.tri(e.x, e.y, w, 17f * e.fout(), e.rotation);
Shapes.tri(e.x, e.y, w, 4f * e.fout(), e.rotation + 180f);
Drawf.tri(e.x, e.y, w, 17f * e.fout(), e.rotation);
Drawf.tri(e.x, e.y, w, 4f * e.fout(), e.rotation + 180f);
Draw.reset();
});
@@ -698,16 +698,16 @@ public class Fx implements ContentList{
shootBig = new Effect(9, e -> {
Draw.color(Pal.lighterOrange, Pal.lightOrange, e.fin());
float w = 1.2f + 7 * e.fout();
Shapes.tri(e.x, e.y, w, 25f * e.fout(), e.rotation);
Shapes.tri(e.x, e.y, w, 4f * e.fout(), e.rotation + 180f);
Drawf.tri(e.x, e.y, w, 25f * e.fout(), e.rotation);
Drawf.tri(e.x, e.y, w, 4f * e.fout(), e.rotation + 180f);
Draw.reset();
});
shootBig2 = new Effect(10, e -> {
Draw.color(Pal.lightOrange, Color.GRAY, e.fin());
float w = 1.2f + 8 * e.fout();
Shapes.tri(e.x, e.y, w, 29f * e.fout(), e.rotation);
Shapes.tri(e.x, e.y, w, 5f * e.fout(), e.rotation + 180f);
Drawf.tri(e.x, e.y, w, 29f * e.fout(), e.rotation);
Drawf.tri(e.x, e.y, w, 5f * e.fout(), e.rotation + 180f);
Draw.reset();
});
@@ -829,7 +829,7 @@ public class Fx implements ContentList{
Draw.color(Pal.lancerLaser);
for(int i : Mathf.signs){
Shapes.tri(e.x, e.y, 4f * e.fout(), 29f, e.rotation + 90f * i);
Drawf.tri(e.x, e.y, 4f * e.fout(), 29f, e.rotation + 90f * i);
}
Draw.reset();
@@ -867,7 +867,7 @@ public class Fx implements ContentList{
Draw.color(Pal.lancerLaser);
Angles.randLenVectors(e.id, 2, 1f + 20f * e.fout(), e.rotation, 120f, (x, y) -> {
Shapes.tri(e.x + x, e.y + y, e.fslope() * 3f + 1, e.fslope() * 3f + 1, Mathf.angle(x, y));
Drawf.tri(e.x + x, e.y + y, e.fslope() * 3f + 1, e.fslope() * 3f + 1, Mathf.angle(x, y));
});
Draw.reset();

View File

@@ -148,11 +148,11 @@ public class UI implements ApplicationListener{
incremental = true;
}};
skin.add("outlined-font", generator.generateFont(outlined));
skin.add("default-font", generator.generateFont(param));
skin.add("default-font-chat", generator.generateFont(param));
skin.getFont("default-font").getData().markupEnabled = true;
skin.getFont("default-font").setOwnsTexture(false);
skin.add("outline", generator.generateFont(outlined));
skin.add("default", generator.generateFont(param));
skin.add("chat", generator.generateFont(param));
skin.getFont("default").getData().markupEnabled = true;
skin.getFont("default").setOwnsTexture(false);
}
@Override

View File

@@ -90,7 +90,7 @@ public interface MinerTrait extends Entity{
Draw.color(Color.LIGHT_GRAY, Color.WHITE, 1f - flashScl + Mathf.absin(Time.time(), 0.5f, flashScl));
Shapes.laser(Core.atlas.find("minelaser"), Core.atlas.find("minelaser-end"), px, py, ex, ey, 0.75f);
Drawf.laser(Core.atlas.find("minelaser"), Core.atlas.find("minelaser-end"), px, py, ex, ey, 0.75f);
if(unit instanceof Player && ((Player)unit).isLocal){
Lines.stroke(1f, Pal.accent);

View File

@@ -372,7 +372,7 @@ public class Player extends Unit implements BuilderMinerTrait, ShooterTrait{
}
public void drawName(){
BitmapFont font = Core.scene.skin.getFont("default-font");
BitmapFont font = Core.scene.skin.getFont("default");
GlyphLayout layout = Pools.obtain(GlyphLayout.class, GlyphLayout::new);
final float nameHeight = 11;
final float textHeight = 15;

View File

@@ -399,7 +399,7 @@ public abstract class Unit extends DestructibleEntity implements SaveTrait, Targ
(3f + Mathf.absin(Time.time(), 5f, 1f)) * itemtime);
if(number){
Core.scene.skin.getFont("outlined-font").draw(item.amount + "",
Core.scene.skin.getFont("outline").draw(item.amount + "",
x + Angles.trnsx(rotation + 180f, backTrns),
y + Angles.trnsy(rotation + 180f, backTrns) - 3,
Pal.accent, 0.25f * itemtime, false, Align.center

View File

@@ -1,11 +1,42 @@
package io.anuke.mindustry.graphics;
import io.anuke.arc.Core;
import io.anuke.arc.*;
import io.anuke.arc.graphics.*;
import io.anuke.arc.graphics.g2d.*;
import io.anuke.arc.math.Mathf;
import io.anuke.arc.util.Tmp;
import io.anuke.arc.math.*;
import io.anuke.arc.util.*;
public class Shapes{
public class Drawf{
public static void dashCircle(float x, float y, float rad, Color color){
Lines.stroke(3f, Pal.gray);
Lines.dashCircle(x, y, rad);
Lines.stroke(1f, color);
Lines.dashCircle(x, y, rad);
Draw.reset();
}
public static void circles(float x, float y, float rad, Color color){
int vertices = 30;
Lines.stroke(3f, Pal.gray);
Lines.poly(x, y, vertices, rad);
Lines.stroke(1f, color);
Lines.poly(x, y, vertices, rad);
Draw.reset();
}
public static void arrow(float x, float y, float x2, float y2, float length, float radius){
float angle = Angles.angle(x, y, x2, y2);
float space = 2f;
Tmp.v1.set(x2, y2).sub(x, y).limit(length);
float vx = Tmp.v1.x + x, vy = Tmp.v1.y + y;
Draw.color(Pal.gray);
Fill.poly(vx, vy, 3, radius + space, angle);
Draw.color(Pal.accent);
Fill.poly(vx, vy, 3, radius, angle);
Draw.color();
}
public static void laser(TextureRegion line, TextureRegion edge, float x, float y, float x2, float y2, float scale){
laser(line, edge, x, y, x2, y2, Mathf.angle(x2 - x, y2 - y), scale);

View File

@@ -105,7 +105,7 @@ public class OverlayRenderer{
Draw.reset();
//draw selected block bars and info
//draw selected block
if(input.block == null && !Core.scene.hasMouse()){
Vector2 vec = Core.input.mouseWorld(input.getMouseX(), input.getMouseY());
Tile tile = world.ltileWorld(vec.x, vec.y);
@@ -115,6 +115,7 @@ public class OverlayRenderer{
}
}
//draw selection overlay when dropping item
if(input.isDroppingItem()){
Vector2 v = Core.input.mouseWorld(input.getMouseX(), input.getMouseY());
float size = 8;
@@ -125,9 +126,12 @@ public class OverlayRenderer{
Tile tile = world.ltileWorld(v.x, v.y);
if(tile != null && tile.interactable(player.getTeam()) && tile.block().acceptStack(player.item().item, player.item().amount, tile, player) > 0){
Draw.color(Pal.place);
Lines.square(tile.drawx(), tile.drawy(), tile.block().size * tilesize / 2f + 1 + Mathf.absin(Time.time(), 5f, 1f));
Draw.color();
Lines.stroke(3f, Pal.gray);
Lines.square(tile.drawx(), tile.drawy(), tile.block().size * tilesize / 2f + 3 + Mathf.absin(Time.time(), 5f, 1f));
Lines.stroke(1f, Pal.place);
Lines.square(tile.drawx(), tile.drawy(), tile.block().size * tilesize / 2f + 2 + Mathf.absin(Time.time(), 5f, 1f));
Draw.reset();
}
}
}

View File

@@ -71,7 +71,7 @@ public class Bar extends Element{
Draw.color();
BitmapFont font = Core.scene.skin.getFont("default-font");
BitmapFont font = Core.scene.skin.getFont("default");
GlyphLayout lay = Pools.obtain(GlyphLayout.class, GlyphLayout::new);
lay.setText(font, name);

View File

@@ -190,7 +190,7 @@ public class FileChooser extends FloatingDialog{
GlyphLayout layout = Pools.obtain(GlyphLayout.class, GlyphLayout::new);
layout.setText(Core.scene.skin.getFont("default-font"), navigation.getText());
layout.setText(Core.scene.skin.getFont("default"), navigation.getText());
if(layout.width < navigation.getWidth()){
navigation.setCursorPosition(0);

View File

@@ -50,7 +50,7 @@ public class ChatFragment extends Table{
super();
setFillParent(true);
font = scene.skin.getFont("default-font");
font = scene.skin.getFont("default");
visible(() -> {
if(!Net.active() && messages.size > 0){
@@ -106,7 +106,7 @@ public class ChatFragment extends Table{
chatfield = new TextField("", new TextField.TextFieldStyle(scene.skin.get(TextField.TextFieldStyle.class)));
chatfield.setFilter((field, c) -> field.getText().length() < Vars.maxTextLength);
chatfield.getStyle().background = null;
chatfield.getStyle().font = scene.skin.getFont("default-font-chat");
chatfield.getStyle().font = scene.skin.getFont("chat");
chatfield.getStyle().fontColor = Color.WHITE;
chatfield.setStyle(chatfield.getStyle());

View File

@@ -228,7 +228,7 @@ public class Block extends BlockStorage{
if(renderer.pixelator.enabled()) return;
Color color = valid ? Pal.accent : Pal.remove;
BitmapFont font = Core.scene.skin.getFont("outlined-font");
BitmapFont font = Core.scene.skin.getFont("outline");
GlyphLayout layout = Pools.obtain(GlyphLayout.class, GlyphLayout::new);
boolean ints = font.usesIntegerPositions();
font.setUseIntegerPositions(false);

View File

@@ -9,7 +9,7 @@ import io.anuke.arc.util.*;
import io.anuke.mindustry.content.Fx;
import io.anuke.mindustry.entities.Effects;
import io.anuke.mindustry.entities.type.TileEntity;
import io.anuke.mindustry.graphics.Pal;
import io.anuke.mindustry.graphics.*;
import io.anuke.mindustry.world.*;
import io.anuke.mindustry.world.meta.*;
@@ -101,9 +101,7 @@ public class MendProjector extends Block{
@Override
public void drawPlace(int x, int y, int rotation, boolean valid){
Draw.color(Pal.accent);
Lines.dashCircle(x * tilesize, y * tilesize, range);
Draw.color();
Drawf.dashCircle(x * tilesize, y * tilesize, range, Pal.accent);
}
@Override
@@ -111,9 +109,7 @@ public class MendProjector extends Block{
MendEntity entity = tile.entity();
float realRange = range + entity.phaseHeat * phaseRangeBoost;
Draw.color(color);
Lines.dashCircle(tile.drawx(), tile.drawy(), realRange);
Draw.color();
Drawf.dashCircle(tile.drawx(), tile.drawy(), realRange, color);
}
@Override

View File

@@ -7,7 +7,7 @@ import io.anuke.arc.graphics.g2d.*;
import io.anuke.arc.math.Mathf;
import io.anuke.arc.util.Time;
import io.anuke.mindustry.entities.type.TileEntity;
import io.anuke.mindustry.graphics.Pal;
import io.anuke.mindustry.graphics.*;
import io.anuke.mindustry.world.*;
import io.anuke.mindustry.world.meta.*;
@@ -52,9 +52,7 @@ public class OverdriveProjector extends Block{
@Override
public void drawPlace(int x, int y, int rotation, boolean valid){
Draw.color(Pal.accent);
Lines.dashCircle(x * tilesize + offset(), y * tilesize + offset(), range);
Draw.color();
Drawf.dashCircle(x * tilesize + offset(), y * tilesize + offset(), range, Pal.accent);
}
@Override
@@ -114,9 +112,7 @@ public class OverdriveProjector extends Block{
OverdriveEntity entity = tile.entity();
float realRange = range + entity.phaseHeat * phaseRangeBoost;
Draw.color(color);
Lines.dashCircle(tile.drawx(), tile.drawy(), realRange);
Draw.color();
Drawf.dashCircle(tile.drawx(), tile.drawy(), realRange, color);
}
@Override
@@ -128,9 +124,7 @@ public class OverdriveProjector extends Block{
Draw.color(color, phase, entity.phaseHeat);
Draw.alpha(entity.heat * Mathf.absin(Time.time(), 10f, 1f) * 0.5f);
//Draw.blend(Blending.additive);
Draw.rect(topRegion, tile.drawx(), tile.drawy());
//Draw.blend();
Draw.alpha(1f);
Lines.stroke((2f * f + 0.2f) * entity.heat);
Lines.square(tile.drawx(), tile.drawy(), (1f - f) * 8f);

View File

@@ -18,8 +18,7 @@ import io.anuke.mindustry.entities.bullet.Bullet;
import io.anuke.mindustry.entities.bullet.BulletType;
import io.anuke.mindustry.entities.traits.TargetTrait;
import io.anuke.mindustry.entities.type.TileEntity;
import io.anuke.mindustry.graphics.Layer;
import io.anuke.mindustry.graphics.Pal;
import io.anuke.mindustry.graphics.*;
import io.anuke.mindustry.world.Block;
import io.anuke.mindustry.world.Tile;
import io.anuke.mindustry.world.meta.*;
@@ -130,16 +129,12 @@ public abstract class Turret extends Block{
@Override
public void drawSelect(Tile tile){
Draw.color(tile.getTeam().color);
Lines.dashCircle(tile.drawx(), tile.drawy(), range);
Draw.reset();
Drawf.dashCircle(tile.drawx(), tile.drawy(), range, tile.getTeam().color);
}
@Override
public void drawPlace(int x, int y, int rotation, boolean valid){
Lines.stroke(1f, Pal.placing);
Lines.dashCircle(x * tilesize + offset(), y * tilesize + offset(), range);
Draw.color();
Drawf.dashCircle(x * tilesize + offset(), y * tilesize + offset(), range, Pal.placing);
}
@Override

View File

@@ -1,28 +1,22 @@
package io.anuke.mindustry.world.blocks.distribution;
import io.anuke.annotations.Annotations.Loc;
import io.anuke.annotations.Annotations.Remote;
import io.anuke.arc.Core;
import io.anuke.arc.collection.OrderedSet;
import io.anuke.annotations.Annotations.*;
import io.anuke.arc.*;
import io.anuke.arc.collection.*;
import io.anuke.arc.graphics.g2d.*;
import io.anuke.arc.math.Angles;
import io.anuke.arc.math.Mathf;
import io.anuke.arc.util.Time;
import io.anuke.arc.util.pooling.Pool.Poolable;
import io.anuke.arc.util.pooling.Pools;
import io.anuke.mindustry.content.Bullets;
import io.anuke.mindustry.content.Fx;
import io.anuke.mindustry.entities.Effects;
import io.anuke.mindustry.entities.Effects.Effect;
import io.anuke.mindustry.entities.bullet.Bullet;
import io.anuke.mindustry.entities.type.Player;
import io.anuke.mindustry.entities.type.TileEntity;
import io.anuke.mindustry.gen.Call;
import io.anuke.mindustry.graphics.Layer;
import io.anuke.mindustry.graphics.Pal;
import io.anuke.mindustry.type.Item;
import io.anuke.mindustry.world.Block;
import io.anuke.mindustry.world.Tile;
import io.anuke.arc.math.*;
import io.anuke.arc.util.*;
import io.anuke.arc.util.pooling.Pool.*;
import io.anuke.arc.util.pooling.*;
import io.anuke.mindustry.content.*;
import io.anuke.mindustry.entities.*;
import io.anuke.mindustry.entities.Effects.*;
import io.anuke.mindustry.entities.bullet.*;
import io.anuke.mindustry.entities.type.*;
import io.anuke.mindustry.gen.*;
import io.anuke.mindustry.graphics.*;
import io.anuke.mindustry.type.*;
import io.anuke.mindustry.world.*;
import java.io.*;
@@ -167,9 +161,7 @@ public class MassDriver extends Block{
@Override
public void drawPlace(int x, int y, int rotation, boolean valid){
Draw.color(Pal.accent);
Lines.dashCircle(x * tilesize, y*tilesize, range);
Draw.color();
Drawf.dashCircle(x * tilesize, y*tilesize, range, Pal.accent);
}
@Override
@@ -178,21 +170,17 @@ public class MassDriver extends Block{
Draw.color(Pal.accent);
Lines.stroke(1f);
Lines.poly(tile.drawx(), tile.drawy(), 20, (tile.block().size / 2f + 1) * tilesize + sin);
Drawf.circles(tile.drawx(), tile.drawy(), (tile.block().size / 2f + 1) * tilesize + sin - 2f, Pal.accent);
MassDriverEntity entity = tile.entity();
if(linkValid(tile)){
Tile target = world.tile(entity.link);
Draw.color(Pal.place);
Lines.poly(target.drawx(), target.drawy(), 20, (target.block().size / 2f + 1) * tilesize + sin);
Draw.reset();
Drawf.circles(target.drawx(), target.drawy(), (target.block().size / 2f + 1) * tilesize + sin - 2f, Pal.place);
Drawf.arrow(tile.drawx(), tile.drawy(), target.drawx(), target.drawy(), size * tilesize + sin, 4f + sin);
}
Draw.color(Pal.accent);
Lines.dashCircle(tile.drawx(), tile.drawy(), range);
Draw.color();
Drawf.dashCircle(tile.drawx(), tile.drawy(), range, Pal.accent);
}
@Override

View File

@@ -257,7 +257,7 @@ public class PowerNode extends PowerBlock{
y2 += t2.y;
Draw.color(Pal.powerLight, Color.WHITE, Mathf.absin(Time.time(), 8f, 0.3f) + 0.2f);
Shapes.laser(laser, laserEnd, x1, y1, x2, y2, 0.6f);
Drawf.laser(laser, laserEnd, x1, y1, x2, y2, 0.6f);
Draw.color();
}

View File

@@ -113,7 +113,7 @@ public class Drill extends Block{
if(entity.dominantItem != null && drawMineItem){
Draw.color(entity.dominantItem.color);
Fill.square(tile.drawx(), tile.drawy(), 1f);
Draw.rect("drill-top", tile.drawx(), tile.drawy(), 1f);
Draw.color();
}
}
@@ -152,6 +152,19 @@ public class Drill extends Block{
}
}
@Override
public void drawSelect(Tile tile){
DrillEntity entity = tile.entity();
if(entity.dominantItem != null){
float dx = tile.drawx() - size * tilesize/2f, dy = tile.drawy() + size * tilesize/2f;
Draw.mixcol(Color.DARK_GRAY, 1f);
Draw.rect(entity.dominantItem.icon(Item.Icon.large), dx, dy);
Draw.reset();
Draw.rect(entity.dominantItem.icon(Item.Icon.medium), dx, dy);
}
}
@Override
public void setStats(){
super.setStats();

View File

@@ -55,9 +55,7 @@ public class RepairPoint extends Block{
@Override
public void drawSelect(Tile tile){
Draw.color(Pal.accent);
Lines.dashCircle(tile.drawx(), tile.drawy(), repairRadius);
Draw.color();
Drawf.dashCircle(tile.drawx(), tile.drawy(), repairRadius, Pal.accent);
}
@Override
@@ -82,7 +80,7 @@ public class RepairPoint extends Block{
float len = 5f;
Draw.color(Color.valueOf("e8ffd7"));
Shapes.laser(laser, laserEnd,
Drawf.laser(laser, laserEnd,
tile.drawx() + Angles.trnsx(ang, len), tile.drawy() + Angles.trnsy(ang, len),
entity.target.x, entity.target.y, entity.strength);
Draw.color();