mirror of
https://github.com/Anuken/Mindustry.git
synced 2025-12-06 02:40:23 -08:00
Use sprites instead of polygons (#6725)
Lines.circle is quite expensive and used for some minor effects. This has been changed to use sprites in certain places.
This commit is contained in:
parent
ee3911cceb
commit
2dae8fdef4
4 changed files with 11 additions and 7 deletions
BIN
core/assets-raw/sprites/shapes/ring-item.png
Normal file
BIN
core/assets-raw/sprites/shapes/ring-item.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 488 B |
|
|
@ -134,3 +134,4 @@ citrusMarmelade
|
||||||
Evolveye
|
Evolveye
|
||||||
Jerzy Paciorkiewicz
|
Jerzy Paciorkiewicz
|
||||||
YozoZChomutova
|
YozoZChomutova
|
||||||
|
Qendolin
|
||||||
|
|
|
||||||
|
|
@ -133,8 +133,8 @@ public class Fx{
|
||||||
float x = Tmp.v1.x, y = Tmp.v1.y;
|
float x = Tmp.v1.x, y = Tmp.v1.y;
|
||||||
float size = 1f;
|
float size = 1f;
|
||||||
|
|
||||||
stroke(e.fslope() * 2f * size, Pal.accent);
|
color(Pal.accent);
|
||||||
Lines.circle(x, y, e.fslope() * 2f * size);
|
Fill.circle(x, y, e.fslope() * 3f * size);
|
||||||
|
|
||||||
color(e.color);
|
color(e.color);
|
||||||
Fill.circle(x, y, e.fslope() * 1.5f * size);
|
Fill.circle(x, y, e.fslope() * 1.5f * size);
|
||||||
|
|
|
||||||
|
|
@ -39,6 +39,7 @@ import static mindustry.Vars.*;
|
||||||
public class UnitType extends UnlockableContent{
|
public class UnitType extends UnlockableContent{
|
||||||
public static final float shadowTX = -12, shadowTY = -13;
|
public static final float shadowTX = -12, shadowTY = -13;
|
||||||
private static final Vec2 legOffset = new Vec2();
|
private static final Vec2 legOffset = new Vec2();
|
||||||
|
private static TextureRegion itemCircleRegion;
|
||||||
|
|
||||||
/** If true, the unit is always at elevation 1. */
|
/** If true, the unit is always at elevation 1. */
|
||||||
public boolean flying;
|
public boolean flying;
|
||||||
|
|
@ -736,14 +737,16 @@ public class UnitType extends UnlockableContent{
|
||||||
unit.x + Angles.trnsx(unit.rotation + 180f, itemOffsetY),
|
unit.x + Angles.trnsx(unit.rotation + 180f, itemOffsetY),
|
||||||
unit.y + Angles.trnsy(unit.rotation + 180f, itemOffsetY),
|
unit.y + Angles.trnsy(unit.rotation + 180f, itemOffsetY),
|
||||||
size, size, unit.rotation);
|
size, size, unit.rotation);
|
||||||
|
|
||||||
Draw.mixcol();
|
Draw.mixcol();
|
||||||
|
|
||||||
Lines.stroke(1f, Pal.accent);
|
if(itemCircleRegion == null || itemCircleRegion.texture.isDisposed()){
|
||||||
Lines.circle(
|
itemCircleRegion = Core.atlas.find("ring-item");
|
||||||
|
}
|
||||||
|
size = (3f + Mathf.absin(Time.time, 5f, 1f)) * unit.itemTime + 0.5f;
|
||||||
|
Draw.color(Pal.accent);
|
||||||
|
Draw.rect(itemCircleRegion,
|
||||||
unit.x + Angles.trnsx(unit.rotation + 180f, itemOffsetY),
|
unit.x + Angles.trnsx(unit.rotation + 180f, itemOffsetY),
|
||||||
unit.y + Angles.trnsy(unit.rotation + 180f, itemOffsetY),
|
unit.y + Angles.trnsy(unit.rotation + 180f, itemOffsetY), size * 2, size * 2);
|
||||||
(3f + Mathf.absin(Time.time, 5f, 1f)) * unit.itemTime);
|
|
||||||
|
|
||||||
if(unit.isLocal() && !renderer.pixelator.enabled()){
|
if(unit.isLocal() && !renderer.pixelator.enabled()){
|
||||||
Fonts.outline.draw(unit.stack.amount + "",
|
Fonts.outline.draw(unit.stack.amount + "",
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue