mirror of
https://github.com/Anuken/Mindustry.git
synced 2026-10-02 11:10:50 +03:00
Made pings display the same size regardless of zoom
This commit is contained in:
@@ -360,19 +360,21 @@ abstract class PlayerComp implements UnitController, Entityc, Syncc, Timerc, Dra
|
||||
|
||||
pingTime -= Time.delta / pingDuration;
|
||||
|
||||
float s = Scl.scl(4) / renderer.getDisplayScale();
|
||||
|
||||
Draw.z(Layer.playerName);
|
||||
float z = Drawf.text();
|
||||
float hover = Mathf.absin(5f, 1f);
|
||||
float scaling = 1f + Mathf.clamp(Interp.pow5In.apply(Mathf.map(pingTime, 1f, 0.96f, 1f, 0f))) * 3f;
|
||||
|
||||
Drawf.square(pingX, pingY, 2f * scaling, 45f, Tmp.c1, Tmp.c3.set(Color.darkGray).mul(color).a(Tmp.c1.a));
|
||||
Drawf.fillPoly(pingX, pingY + 9f + hover, 3, 3f, -90f, Tmp.c1, Tmp.c3);
|
||||
Drawf.square(pingX, pingY, 2f * scaling * s, 45f, Tmp.c1, Tmp.c3.set(Color.darkGray).mul(color).a(Tmp.c1.a), s);
|
||||
Drawf.fillPoly(pingX, pingY + 9f * s + hover * s, 3, 3f * s, -90f, Tmp.c1, Tmp.c3, s);
|
||||
|
||||
if(pingText != null){
|
||||
Drawf.text(name, pingX, pingY + 20f + hover, Tmp.c1, 0.7f);
|
||||
Drawf.text(pingText, pingX, pingY + 16f + hover, Tmp.c2.set(1f, 1f, 1f, Tmp.c1.a));
|
||||
Drawf.text(name, pingX, pingY + (20f + hover)*s, Tmp.c1, 0.7f * s);
|
||||
Drawf.text(pingText, pingX, pingY + (16f + hover)*s, Tmp.c2.set(1f, 1f, 1f, Tmp.c1.a), s);
|
||||
}else{
|
||||
Drawf.text(name, pingX, pingY + 16f + hover, Tmp.c1);
|
||||
Drawf.text(name, pingX, pingY + (16f + hover)*s, Tmp.c1, s);
|
||||
}
|
||||
|
||||
Draw.reset();
|
||||
|
||||
@@ -418,10 +418,14 @@ public class Drawf{
|
||||
}
|
||||
|
||||
public static void square(float x, float y, float radius, float rotation, Color color, Color bgColor){
|
||||
Lines.stroke(3f, bgColor);
|
||||
Lines.square(x, y, radius + 1f, rotation);
|
||||
Lines.stroke(1f, color);
|
||||
Lines.square(x, y, radius + 1f, rotation);
|
||||
square(x, y, radius, rotation, color, bgColor, 1f);
|
||||
}
|
||||
|
||||
public static void square(float x, float y, float radius, float rotation, Color color, Color bgColor, float scaling){
|
||||
Lines.stroke(3f * scaling, bgColor);
|
||||
Lines.square(x, y, radius + 1f * scaling, rotation);
|
||||
Lines.stroke(1f * scaling, color);
|
||||
Lines.square(x, y, radius + 1f * scaling, rotation);
|
||||
Draw.reset();
|
||||
}
|
||||
|
||||
@@ -444,12 +448,12 @@ public class Drawf{
|
||||
}
|
||||
|
||||
public static void fillPoly(float x, float y, int sides, float radius, float rotation, Color color){
|
||||
fillPoly(x, y, sides, radius, rotation, color, Pal.gray);
|
||||
fillPoly(x, y, sides, radius, rotation, color, Pal.gray, 1f);
|
||||
}
|
||||
|
||||
public static void fillPoly(float x, float y, int sides, float radius, float rotation, Color color, Color bgColor){
|
||||
public static void fillPoly(float x, float y, int sides, float radius, float rotation, Color color, Color bgColor, float scl){
|
||||
Draw.color(bgColor, color.a);
|
||||
Fill.poly(x, y, sides, radius + 2f, rotation);
|
||||
Fill.poly(x, y, sides, radius + 2f*scl, rotation);
|
||||
Draw.color(color);
|
||||
Fill.poly(x, y, sides, radius, rotation);
|
||||
Draw.reset();
|
||||
|
||||
Reference in New Issue
Block a user