Packed Liquid Drawer
This commit is contained in:
@@ -96,6 +96,20 @@ public class Drawf{
|
||||
Draw.color();
|
||||
}
|
||||
|
||||
public static void liquid(TextureRegion region, float x, float y, float alpha, Color color, float rotation){
|
||||
Draw.color(color);
|
||||
Draw.alpha(alpha);
|
||||
Draw.rect(region, x, y, rotation);
|
||||
Draw.reset();
|
||||
}
|
||||
|
||||
public static void liquid(TextureRegion region, float x, float y, float alpha, Color color){
|
||||
Draw.color(color);
|
||||
Draw.alpha(alpha);
|
||||
Draw.rect(region, x, y);
|
||||
Draw.reset();
|
||||
}
|
||||
|
||||
public static void dashCircle(float x, float y, float rad, Color color){
|
||||
Lines.stroke(3f, Pal.gray);
|
||||
Lines.dashCircle(x, y, rad);
|
||||
|
||||
@@ -59,10 +59,7 @@ public class LiquidTurret extends Turret{
|
||||
super.draw();
|
||||
|
||||
if(liquidRegion.found()){
|
||||
Draw.color(liquids.current().color);
|
||||
Draw.alpha(liquids.total() / liquidCapacity);
|
||||
Draw.rect(liquidRegion, x + tr2.x, y + tr2.y, rotation - 90);
|
||||
Draw.reset();
|
||||
Drawf.liquid(liquidRegion, x + tr2.x, y + tr2.y, liquids.total() / liquidCapacity, liquids.current().color, rotation - 90);
|
||||
}
|
||||
if(topRegion.found()) Draw.rect(topRegion, x + tr2.x, y + tr2.y, rotation - 90);
|
||||
}
|
||||
|
||||
@@ -103,10 +103,7 @@ public class Conduit extends LiquidBlock implements Autotiler{
|
||||
Draw.color(botColor);
|
||||
Draw.rect(sliced(botRegions[bits], slice), x, y, rotation);
|
||||
|
||||
Draw.color(liquids.current().color);
|
||||
Draw.alpha(smoothLiquid);
|
||||
Draw.rect(sliced(botRegions[bits], slice), x, y, rotation);
|
||||
Draw.color();
|
||||
Drawf.liquid(sliced(botRegions[bits], slice), x, y, smoothLiquid, liquids.current().color, rotation);
|
||||
|
||||
Draw.rect(sliced(topRegions[bits], slice), x, y, rotation);
|
||||
}
|
||||
|
||||
@@ -32,10 +32,7 @@ public class LiquidBlock extends Block{
|
||||
Draw.rect(bottomRegion, x, y, rotation);
|
||||
|
||||
if(liquids.total() > 0.001f){
|
||||
Draw.color(liquids.current().color);
|
||||
Draw.alpha(liquids.total() / liquidCapacity);
|
||||
Draw.rect(liquidRegion, x, y, rotation);
|
||||
Draw.color();
|
||||
Drawf.liquid(liquidRegion, x, y, liquids.total() / liquidCapacity, liquids.current().color);
|
||||
}
|
||||
|
||||
Draw.rect(topRegion, x, y, rotation);
|
||||
|
||||
@@ -41,10 +41,7 @@ public class BurnerGenerator extends ItemLiquidGenerator{
|
||||
Draw.rect(capRegion, x, y);
|
||||
|
||||
if(hasLiquids){
|
||||
Draw.color(liquids.current().color);
|
||||
Draw.alpha(liquids.currentAmount() / liquidCapacity);
|
||||
Draw.rect(liquidRegion, x, y);
|
||||
Draw.color();
|
||||
Drawf.liquid(liquidRegion, x, y, liquids.total() / liquidCapacity, liquids.current().color);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -165,10 +165,7 @@ public class ItemLiquidGenerator extends PowerGenerator{
|
||||
}
|
||||
|
||||
if(hasLiquids){
|
||||
Draw.color(liquids.current().color);
|
||||
Draw.alpha(liquids.currentAmount() / liquidCapacity);
|
||||
Draw.rect(liquidRegion, x, y);
|
||||
Draw.color();
|
||||
Drawf.liquid(liquidRegion, x, y, liquids.total() / liquidCapacity, liquids.current().color);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -70,9 +70,7 @@ public class Cultivator extends GenericCrafter{
|
||||
public void draw(){
|
||||
Draw.rect(region, x, y);
|
||||
|
||||
Draw.color(plantColor);
|
||||
Draw.alpha(warmup);
|
||||
Draw.rect(middleRegion, x, y);
|
||||
Drawf.liquid(middleRegion, x, y, warmup, plantColor);
|
||||
|
||||
Draw.color(bottomColor, plantColorLight, warmup);
|
||||
|
||||
|
||||
@@ -44,10 +44,7 @@ public class Fracker extends SolidPump{
|
||||
Draw.rect(region, x, y);
|
||||
super.drawCracks();
|
||||
|
||||
Draw.color(result.color);
|
||||
Draw.alpha(liquids.get(result) / liquidCapacity);
|
||||
Draw.rect(liquidRegion, x, y);
|
||||
Draw.color();
|
||||
Drawf.liquid(liquidRegion, x, y, liquids.total() / liquidCapacity, result.color);
|
||||
|
||||
Draw.rect(rotatorRegion, x, y, pumpTime);
|
||||
Draw.rect(topRegion, x, y);
|
||||
|
||||
@@ -85,10 +85,7 @@ public class Pump extends LiquidBlock{
|
||||
public void draw(){
|
||||
Draw.rect(name, x, y);
|
||||
|
||||
Draw.color(liquids.current().color);
|
||||
Draw.alpha(liquids.total() / liquidCapacity);
|
||||
Draw.rect(liquidRegion, x, y);
|
||||
Draw.color();
|
||||
Drawf.liquid(liquidRegion, x, y, liquids.total() / liquidCapacity, liquids.current().color);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -78,9 +78,7 @@ public class Separator extends Block{
|
||||
public void draw(){
|
||||
super.draw();
|
||||
|
||||
Draw.color(liquids.current().color);
|
||||
Draw.alpha(liquids.total() / liquidCapacity);
|
||||
Draw.rect(liquidRegion, x, y);
|
||||
Drawf.liquid(liquidRegion, x, y, liquids.total() / liquidCapacity, liquids.current().color);
|
||||
|
||||
Draw.reset();
|
||||
if(Core.atlas.isFound(spinnerRegion)){
|
||||
|
||||
@@ -87,10 +87,7 @@ public class SolidPump extends Pump{
|
||||
@Override
|
||||
public void draw(){
|
||||
Draw.rect(region, x, y);
|
||||
Draw.color(liquids.current().color);
|
||||
Draw.alpha(liquids.total() / liquidCapacity);
|
||||
Draw.rect(liquidRegion, x, y);
|
||||
Draw.color();
|
||||
Drawf.liquid(liquidRegion, x, y, liquids.total() / liquidCapacity, liquids.current().color);
|
||||
Draw.rect(rotatorRegion, x, y, pumpTime * rotateSpeed);
|
||||
Draw.rect(topRegion, x, y);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user