Arc compatibility update
This commit is contained in:
@@ -202,14 +202,14 @@ public class Mechs implements ContentList{
|
||||
public void draw(Player player){
|
||||
if(player.shootHeat <= 0.01f) return;
|
||||
|
||||
float alpha = Core.graphics.batch().getColor().a;
|
||||
float alpha = Draw.getColor().a;
|
||||
Shaders.build.progress = player.shootHeat;
|
||||
Shaders.build.region = armorRegion;
|
||||
Shaders.build.time = Time.time() / 10f;
|
||||
Shaders.build.color.set(Palette.accent).a = player.shootHeat;
|
||||
Draw.shader(Shaders.build);
|
||||
Draw.alpha(1f);
|
||||
Draw.rect(armorRegion, player.snappedX(), player.snappedY()).rot(player.rotation);
|
||||
Draw.rect(armorRegion, player.snappedX(), player.snappedY(), player.rotation);
|
||||
Draw.shader(Shaders.mix);
|
||||
Draw.color(1f, 1f, 1f, alpha);
|
||||
}
|
||||
@@ -268,11 +268,13 @@ public class Mechs implements ContentList{
|
||||
public void draw(Player player){
|
||||
float scl = scld(player);
|
||||
if(scl < 0.01f) return;
|
||||
float alpha = Core.graphics.batch().getColor().a;
|
||||
float alpha = Draw.getColor().a;
|
||||
Draw.shader();
|
||||
Draw.color(Palette.lancerLaser);
|
||||
Draw.alpha(scl/2f);
|
||||
Draw.rect(shield, player.snappedX() + Mathf.range(scl/2f), player.snappedY() + Mathf.range(scl/2f)).rot(player.rotation - 90).blend(Blending.additive);
|
||||
Draw.blend(Blending.additive);
|
||||
Draw.rect(shield, player.snappedX() + Mathf.range(scl/2f), player.snappedY() + Mathf.range(scl/2f), player.rotation - 90);
|
||||
Draw.blend();
|
||||
Draw.shader(Shaders.mix);
|
||||
Draw.color();
|
||||
Draw.alpha(alpha);
|
||||
|
||||
@@ -58,7 +58,7 @@ public class TurretBlocks extends BlockList implements ContentList{
|
||||
ammoUseEffect = ShootFx.shellEjectSmall;
|
||||
health = 160;
|
||||
|
||||
drawer = (tile, entity) -> Draw.rect(entity.target != null ? shootRegion : region, tile.drawx() + tr2.x, tile.drawy() + tr2.y).rot(entity.rotation - 90);
|
||||
drawer = (tile, entity) -> Draw.rect(entity.target != null ? shootRegion : region, tile.drawx() + tr2.x, tile.drawy() + tr2.y, entity.rotation - 90);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -74,11 +74,11 @@ public class TurretBlocks extends BlockList implements ContentList{
|
||||
health = 360;
|
||||
|
||||
drawer = (tile, entity) -> {
|
||||
Draw.rect(region, tile.drawx() + tr2.x, tile.drawy() + tr2.y).rot(entity.rotation - 90);
|
||||
Draw.rect(region, tile.drawx() + tr2.x, tile.drawy() + tr2.y, entity.rotation - 90);
|
||||
|
||||
Draw.color(entity.liquids.current().color);
|
||||
Draw.alpha(entity.liquids.total() / liquidCapacity);
|
||||
Draw.rect(name + "-liquid", tile.drawx() + tr2.x, tile.drawy() + tr2.y).rot(entity.rotation - 90).color(entity.liquids.current().color);
|
||||
Draw.rect(name + "-liquid", tile.drawx() + tr2.x, tile.drawy() + tr2.y, entity.rotation - 90);
|
||||
Draw.color();
|
||||
};
|
||||
}};
|
||||
@@ -157,7 +157,7 @@ public class TurretBlocks extends BlockList implements ContentList{
|
||||
ammoUseEffect = ShootFx.shellEjectBig;
|
||||
|
||||
drawer = (tile, entity) -> {
|
||||
Draw.rect(region, tile.drawx() + tr2.x, tile.drawy() + tr2.y).rot(entity.rotation - 90);
|
||||
Draw.rect(region, tile.drawx() + tr2.x, tile.drawy() + tr2.y, entity.rotation - 90);
|
||||
float offsetx = (int) (abscurve(Mathf.curve(entity.reload / reload, 0.3f, 0.2f)) * 3f);
|
||||
float offsety = -(int) (abscurve(Mathf.curve(entity.reload / reload, 0.3f, 0.2f)) * 2f);
|
||||
|
||||
@@ -165,7 +165,7 @@ public class TurretBlocks extends BlockList implements ContentList{
|
||||
float rot = entity.rotation + 90 * i;
|
||||
Draw.rect(panels[i == -1 ? 0 : 1],
|
||||
tile.drawx() + tr2.x + Angles.trnsx(rot, offsetx, offsety),
|
||||
tile.drawy() + tr2.y + Angles.trnsy(rot, -offsetx, offsety)).rot(entity.rotation - 90);
|
||||
tile.drawy() + tr2.y + Angles.trnsy(rot, -offsetx, offsety), entity.rotation - 90);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -346,10 +346,10 @@ public class TurretBullets extends BulletList implements ContentList{
|
||||
float w = 11f, h = 13f;
|
||||
|
||||
Draw.color(Palette.bulletYellowBack);
|
||||
Draw.rect("shell-back", b.x, b.y, w, h).rot(b.angle() + 90);
|
||||
Draw.rect("shell-back", b.x, b.y, w, h, b.angle() + 90);
|
||||
|
||||
Draw.color(Palette.bulletYellow);
|
||||
Draw.rect("shell", b.x, b.y, w, h).rot(b.angle() + 90);
|
||||
Draw.rect("shell", b.x, b.y, w, h, b.angle() + 90);
|
||||
|
||||
Draw.reset();
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package io.anuke.mindustry.content.fx;
|
||||
|
||||
import io.anuke.arc.Core;
|
||||
import io.anuke.arc.entities.Effects.Effect;
|
||||
import io.anuke.arc.graphics.Color;
|
||||
import io.anuke.arc.graphics.g2d.Draw;
|
||||
@@ -108,10 +109,9 @@ public class ShootFx extends FxList implements ContentList{
|
||||
|
||||
float len = (2f + e.finpow() * 6f) * i;
|
||||
float lr = rot + e.fin() * 30f * i;
|
||||
Draw.rect("white",
|
||||
e.x + Angles.trnsx(lr, len) + Mathf.randomSeedRange(e.id + i + 7, 3f * e.fin()),
|
||||
Fill.rect(e.x + Angles.trnsx(lr, len) + Mathf.randomSeedRange(e.id + i + 7, 3f * e.fin()),
|
||||
e.y + Angles.trnsy(lr, len) + Mathf.randomSeedRange(e.id + i + 8, 3f * e.fin()),
|
||||
1f, 2f).rot(rot + e.fin() * 50f * i);
|
||||
1f, 2f, rot + e.fin() * 50f * i);
|
||||
|
||||
Draw.color();
|
||||
});
|
||||
@@ -122,10 +122,10 @@ public class ShootFx extends FxList implements ContentList{
|
||||
for(int i : Mathf.signs){
|
||||
float len = (2f + e.finpow() * 10f) * i;
|
||||
float lr = rot + e.fin() * 20f * i;
|
||||
Draw.rect("casing",
|
||||
Draw.rect(Core.atlas.find("casing"),
|
||||
e.x + Angles.trnsx(lr, len) + Mathf.randomSeedRange(e.id + i + 7, 3f * e.fin()),
|
||||
e.y + Angles.trnsy(lr, len) + Mathf.randomSeedRange(e.id + i + 8, 3f * e.fin()),
|
||||
2f, 3f).rot(rot);
|
||||
2f, 3f, rot);
|
||||
}
|
||||
|
||||
Draw.color(Color.LIGHT_GRAY, Color.GRAY, e.fin());
|
||||
@@ -145,11 +145,11 @@ public class ShootFx extends FxList implements ContentList{
|
||||
for(int i : Mathf.signs){
|
||||
float len = (4f + e.finpow() * 8f) * i;
|
||||
float lr = rot + Mathf.randomSeedRange(e.id + i + 6, 20f * e.fin()) * i;
|
||||
Draw.rect("casing",
|
||||
Draw.rect(Core.atlas.find("casing"),
|
||||
e.x + Angles.trnsx(lr, len) + Mathf.randomSeedRange(e.id + i + 7, 3f * e.fin()),
|
||||
e.y + Angles.trnsy(lr, len) + Mathf.randomSeedRange(e.id + i + 8, 3f * e.fin()),
|
||||
2.5f, 4f)
|
||||
.rot(rot + e.fin() * 30f * i + Mathf.randomSeedRange(e.id + i + 9, 40f * e.fin()));
|
||||
2.5f, 4f,
|
||||
rot + e.fin() * 30f * i + Mathf.randomSeedRange(e.id + i + 9, 40f * e.fin()));
|
||||
}
|
||||
|
||||
Draw.color(Color.LIGHT_GRAY);
|
||||
|
||||
@@ -50,7 +50,6 @@ public class Control implements ApplicationListener{
|
||||
private boolean hiscore = false;
|
||||
private boolean wasPaused = false;
|
||||
private InputHandler[] inputs = {};
|
||||
private Throwable error;
|
||||
|
||||
public Control(){
|
||||
saves = new Saves();
|
||||
@@ -206,10 +205,6 @@ public class Control implements ApplicationListener{
|
||||
System.arraycopy(oldi, 0, inputs, 0, inputs.length);
|
||||
}
|
||||
|
||||
public void setError(Throwable error){
|
||||
this.error = error;
|
||||
}
|
||||
|
||||
public InputHandler input(int index){
|
||||
return inputs[index];
|
||||
}
|
||||
@@ -308,9 +303,6 @@ public class Control implements ApplicationListener{
|
||||
|
||||
@Override
|
||||
public void update(){
|
||||
if(error != null){
|
||||
throw new RuntimeException(error);
|
||||
}
|
||||
|
||||
saves.update();
|
||||
|
||||
|
||||
@@ -14,6 +14,7 @@ import io.anuke.arc.graphics.Camera;
|
||||
import io.anuke.arc.graphics.Color;
|
||||
import io.anuke.arc.graphics.g2d.Draw;
|
||||
import io.anuke.arc.graphics.g2d.Lines;
|
||||
import io.anuke.arc.graphics.g2d.SpriteBatch;
|
||||
import io.anuke.arc.math.Mathf;
|
||||
import io.anuke.arc.math.geom.Rectangle;
|
||||
import io.anuke.arc.math.geom.Vector2;
|
||||
@@ -30,7 +31,7 @@ import io.anuke.mindustry.entities.units.BaseUnit;
|
||||
import io.anuke.mindustry.game.Team;
|
||||
import io.anuke.mindustry.graphics.*;
|
||||
|
||||
import static io.anuke.arc.Core.camera;
|
||||
import static io.anuke.arc.Core.*;
|
||||
import static io.anuke.arc.Core.graphics;
|
||||
import static io.anuke.mindustry.Vars.*;
|
||||
|
||||
@@ -45,6 +46,7 @@ public class Renderer implements ApplicationListener{
|
||||
private Vector2 avgPosition = new Vector2();
|
||||
|
||||
public Renderer(){
|
||||
batch = new SpriteBatch(4096);
|
||||
camera = new Camera();
|
||||
Lines.setCircleVertices(14);
|
||||
|
||||
@@ -146,7 +148,7 @@ public class Renderer implements ApplicationListener{
|
||||
|
||||
graphics.clear(clearColor);
|
||||
|
||||
graphics.batch().setProjection(camera.projection());
|
||||
Draw.proj(camera.projection());
|
||||
|
||||
blocks.drawFloor();
|
||||
|
||||
|
||||
@@ -11,6 +11,7 @@ import io.anuke.arc.function.Consumer;
|
||||
import io.anuke.arc.graphics.Color;
|
||||
import io.anuke.arc.graphics.Colors;
|
||||
import io.anuke.arc.graphics.g2d.BitmapFont;
|
||||
import io.anuke.arc.graphics.g2d.Draw;
|
||||
import io.anuke.arc.input.KeyCode;
|
||||
import io.anuke.arc.math.Interpolation;
|
||||
import io.anuke.arc.scene.Group;
|
||||
@@ -81,6 +82,7 @@ public class UI implements ApplicationListener{
|
||||
}
|
||||
|
||||
Core.scene = new Scene(skin);
|
||||
Core.input.addProcessor(Core.scene);
|
||||
|
||||
Dialog.setShowAction(() -> sequence(
|
||||
alpha(0f),
|
||||
@@ -142,7 +144,7 @@ public class UI implements ApplicationListener{
|
||||
|
||||
Core.scene.act();
|
||||
Core.scene.draw();
|
||||
Core.graphics.batch().flush();
|
||||
Draw.flush();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -79,7 +79,7 @@ public class MapRenderer implements Disposable{
|
||||
}
|
||||
|
||||
mesh.getTransformMatrix().setToTranslation(tx, ty).scale(tw / (width * tilesize), th / (height * tilesize));
|
||||
mesh.setProjectionMatrix(Core.graphics.batch().getProjection());
|
||||
mesh.setProjectionMatrix(Draw.proj());
|
||||
|
||||
mesh.render(Core.atlas.getTextures().first());
|
||||
}
|
||||
|
||||
@@ -288,7 +288,7 @@ public class Player extends Unit implements BuilderTrait, CarryTrait, ShooterTra
|
||||
float x = snappedX(), y = snappedY();
|
||||
float scl = mech.flying ? 1f : boostHeat / 2f;
|
||||
|
||||
Draw.rect(mech.iconRegion, x + offsetX * scl, y + offsetY * scl).rot(rotation - 90);
|
||||
Draw.rect(mech.iconRegion, x + offsetX * scl, y + offsetY * scl, rotation - 90);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -322,10 +322,10 @@ public class Player extends Unit implements BuilderTrait, CarryTrait, ShooterTra
|
||||
Draw.rect(mech.legRegion,
|
||||
x + Angles.trnsx(baseRotation, ft * i + boostTrnsY, -boostTrnsX * i),
|
||||
y + Angles.trnsy(baseRotation, ft * i + boostTrnsY, -boostTrnsX * i),
|
||||
mech.legRegion.getWidth() * i, mech.legRegion.getHeight() - Mathf.clamp(ft * i, 0, 2)).rot(baseRotation - 90 + boostAng * i);
|
||||
mech.legRegion.getWidth() * i, mech.legRegion.getHeight() - Mathf.clamp(ft * i, 0, 2), baseRotation - 90 + boostAng * i);
|
||||
}
|
||||
|
||||
Draw.rect(mech.baseRegion, x, y).rot(baseRotation - 90);
|
||||
Draw.rect(mech.baseRegion, x, y, baseRotation - 90);
|
||||
}
|
||||
|
||||
if(floor.isLiquid){
|
||||
@@ -334,7 +334,7 @@ public class Player extends Unit implements BuilderTrait, CarryTrait, ShooterTra
|
||||
Draw.tint(Color.WHITE);
|
||||
}
|
||||
|
||||
Draw.rect(mech.region, x, y).rot(rotation - 90);
|
||||
Draw.rect(mech.region, x, y, rotation - 90);
|
||||
|
||||
mech.draw(this);
|
||||
|
||||
@@ -343,7 +343,7 @@ public class Player extends Unit implements BuilderTrait, CarryTrait, ShooterTra
|
||||
float w = i > 0 ? -mech.weapon.equipRegion.getWidth() : mech.weapon.equipRegion.getWidth();
|
||||
Draw.rect(mech.weapon.equipRegion,
|
||||
x + Angles.trnsx(tra, (mech.weaponOffsetX + mech.spreadX(this)) * i, trY),
|
||||
y + Angles.trnsy(tra, (mech.weaponOffsetX + mech.spreadX(this)) * i, trY), w, mech.weapon.equipRegion.getHeight()).rot(rotation - 90);
|
||||
y + Angles.trnsy(tra, (mech.weaponOffsetX + mech.spreadX(this)) * i, trY), w, mech.weapon.equipRegion.getHeight(), rotation - 90);
|
||||
}
|
||||
|
||||
float backTrns = 4f, itemSize = 5f;
|
||||
@@ -357,7 +357,7 @@ public class Player extends Unit implements BuilderTrait, CarryTrait, ShooterTra
|
||||
Draw.rect(stack.item.region,
|
||||
x + Angles.trnsx(rotation + 180f + angT, backTrns + lenT),
|
||||
y + Angles.trnsy(rotation + 180f + angT, backTrns + lenT),
|
||||
itemSize, itemSize).rot(rotation);
|
||||
itemSize, itemSize, rotation);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -370,7 +370,7 @@ public class Player extends Unit implements BuilderTrait, CarryTrait, ShooterTra
|
||||
|
||||
Draw.color(Color.BLACK, team.color, healthf() + Mathf.absin(Time.time(), healthf() * 5f, 1f - healthf()));
|
||||
Draw.alpha(hitTime / hitDuration);
|
||||
Draw.rect(getPowerCellRegion(), x + Angles.trnsx(rotation, mech.cellTrnsY, 0f), y + Angles.trnsy(rotation, mech.cellTrnsY, 0f)).rot(rotation - 90);
|
||||
Draw.rect(getPowerCellRegion(), x + Angles.trnsx(rotation, mech.cellTrnsY, 0f), y + Angles.trnsy(rotation, mech.cellTrnsY, 0f), rotation - 90);
|
||||
Draw.color();
|
||||
}
|
||||
|
||||
@@ -406,7 +406,9 @@ public class Player extends Unit implements BuilderTrait, CarryTrait, ShooterTra
|
||||
font.setUseIntegerPositions(false);
|
||||
font.getData().setScale(0.25f / io.anuke.arc.scene.ui.layout.Unit.dp.scl(1f));
|
||||
layout.setText(font, name);
|
||||
Fill.rect().center(x, y + 8 - layout.height / 2, layout.width + 2, layout.height + 3).color(0f, 0f, 0f, 0.3f);
|
||||
Draw.color(0f, 0f, 0f, 0.3f);
|
||||
Fill.rect(x, y + 8 - layout.height / 2, layout.width + 2, layout.height + 3);
|
||||
Draw.color();
|
||||
font.setColor(color);
|
||||
|
||||
font.draw(name, x, y + 8, 0, Align.center, false);
|
||||
@@ -414,9 +416,9 @@ public class Player extends Unit implements BuilderTrait, CarryTrait, ShooterTra
|
||||
if(isAdmin){
|
||||
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.rect(Core.atlas.find("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.rect(Core.atlas.find("icon-admin-small"), x + layout.width / 2f + 2 + 1, y + 7f, s, s);
|
||||
}
|
||||
|
||||
Draw.reset();
|
||||
|
||||
@@ -320,7 +320,7 @@ public abstract class Unit extends DestructibleEntity implements SaveTrait, Targ
|
||||
public void drawStats(){
|
||||
Draw.color(Color.BLACK, team.color, healthf() + Mathf.absin(Time.time(), healthf()*5f, 1f - healthf()));
|
||||
Draw.alpha(hitTime);
|
||||
Draw.rect(getPowerCellRegion(), x, y).rot(rotation - 90);
|
||||
Draw.rect(getPowerCellRegion(), x, y, rotation - 90);
|
||||
Draw.color();
|
||||
}
|
||||
|
||||
@@ -336,7 +336,7 @@ public abstract class Unit extends DestructibleEntity implements SaveTrait, Targ
|
||||
}
|
||||
|
||||
public void drawShadow(float offsetX, float offsetY){
|
||||
Draw.rect(getIconRegion(), x + offsetX, y + offsetY).rot(rotation - 90);
|
||||
Draw.rect(getIconRegion(), x + offsetX, y + offsetY, rotation - 90);
|
||||
}
|
||||
|
||||
public void drawView(){
|
||||
|
||||
@@ -34,9 +34,9 @@ public class ArtilleryBulletType extends BasicBulletType{
|
||||
float height = bulletHeight * ((1f - bulletShrink) + bulletShrink * b.fout());
|
||||
|
||||
Draw.color(backColor);
|
||||
Draw.rect(backRegion, b.x, b.y, bulletWidth * scale, height * scale).rot(b.angle() - 90);
|
||||
Draw.rect(backRegion, b.x, b.y, bulletWidth * scale, height * scale, b.angle() - 90);
|
||||
Draw.color(frontColor);
|
||||
Draw.rect(frontRegion, b.x, b.y, bulletWidth * scale, height * scale).rot(b.angle() - 90);
|
||||
Draw.rect(frontRegion, b.x, b.y, bulletWidth * scale, height * scale, b.angle() - 90);
|
||||
Draw.color();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -57,9 +57,9 @@ public class BasicBulletType extends BulletType{
|
||||
float height = bulletHeight * ((1f - bulletShrink) + bulletShrink * b.fout());
|
||||
|
||||
Draw.color(backColor);
|
||||
Draw.rect(backRegion, b.x, b.y, bulletWidth, height).rot(b.angle() - 90);
|
||||
Draw.rect(backRegion, b.x, b.y, bulletWidth, height, b.angle() - 90);
|
||||
Draw.color(frontColor);
|
||||
Draw.rect(frontRegion, b.x, b.y, bulletWidth, height).rot(b.angle() - 90);
|
||||
Draw.rect(frontRegion, b.x, b.y, bulletWidth, height, b.angle() - 90);
|
||||
Draw.color();
|
||||
}
|
||||
|
||||
|
||||
@@ -26,6 +26,6 @@ public class RubbleDecal extends Decal{
|
||||
return;
|
||||
}
|
||||
|
||||
Draw.rect(region, x, y).rot(Mathf.randomSeed(id, 0, 4) * 90);
|
||||
Draw.rect(region, x, y, Mathf.randomSeed(id, 0, 4) * 90);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -36,8 +36,7 @@ public class ScorchDecal extends Decal{
|
||||
TextureRegion region = regions[Mathf.randomSeed(id - i, 0, scorches - 1)];
|
||||
float rotation = Mathf.randomSeed(id + i, 0, 360);
|
||||
float space = 1.5f + Mathf.randomSeed(id + i + 1, 0, 20) / 10f;
|
||||
Draw.rect(region, x + Angles.trnsx(rotation, space), y + Angles.trnsy(rotation, space) + region.getHeight()/2f)
|
||||
.origin(region.getWidth()/2f, 0).rot(rotation - 90);
|
||||
Draw.rect(region, x + Angles.trnsx(rotation, space), y + Angles.trnsy(rotation, space) + region.getHeight()/2f, region.getWidth()/2f, 0, rotation - 90);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -216,7 +216,7 @@ public abstract class BaseUnit extends Unit implements ShooterTrait{
|
||||
Draw.rect(stack.item.region,
|
||||
x + Angles.trnsx(rotation + 180f + angT, backTrns + lenT),
|
||||
y + Angles.trnsy(rotation + 180f + angT, backTrns + lenT),
|
||||
itemSize, itemSize).rot(rotation);
|
||||
itemSize, itemSize, rotation);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -164,7 +164,7 @@ public abstract class FlyingUnit extends BaseUnit implements CarryTrait{
|
||||
public void draw(){
|
||||
Draw.alpha(hitTime / hitDuration);
|
||||
|
||||
Draw.rect(type.name, x, y).rot(rotation - 90);
|
||||
Draw.rect(type.name, x, y, rotation - 90);
|
||||
|
||||
drawItems();
|
||||
|
||||
|
||||
@@ -154,7 +154,7 @@ public abstract class GroundUnit extends BaseUnit{
|
||||
Draw.rect(type.legRegion,
|
||||
x + Angles.trnsx(baseRotation, ft * i),
|
||||
y + Angles.trnsy(baseRotation, ft * i),
|
||||
12f * i, 12f - Mathf.clamp(ft * i, 0, 2)).rot(baseRotation - 90);
|
||||
12f * i, 12f - Mathf.clamp(ft * i, 0, 2), baseRotation - 90);
|
||||
}
|
||||
|
||||
if(floor.isLiquid){
|
||||
@@ -163,16 +163,16 @@ public abstract class GroundUnit extends BaseUnit{
|
||||
Draw.tint(Color.WHITE);
|
||||
}
|
||||
|
||||
Draw.rect(type.baseRegion, x, y).rot(baseRotation - 90);
|
||||
Draw.rect(type.baseRegion, x, y, baseRotation - 90);
|
||||
|
||||
Draw.rect(type.region, x, y).rot(rotation - 90);
|
||||
Draw.rect(type.region, x, y, rotation - 90);
|
||||
|
||||
for(int i : Mathf.signs){
|
||||
float tra = rotation - 90, trY = -weapon.getRecoil(this, i > 0) + type.weaponOffsetY;
|
||||
float w = i > 0 ? -12 : 12;
|
||||
Draw.rect(weapon.equipRegion,
|
||||
x + Angles.trnsx(tra, type.weaponOffsetX * i, trY),
|
||||
y + Angles.trnsy(tra, type.weaponOffsetX * i, trY), w, 12).rot(rotation - 90);
|
||||
y + Angles.trnsy(tra, type.weaponOffsetX * i, trY), w, 12, rotation - 90);
|
||||
}
|
||||
|
||||
drawItems();
|
||||
|
||||
@@ -142,7 +142,7 @@ public class Saves{
|
||||
IntArray result = new IntArray(saves.size);
|
||||
for(int i = 0; i < saves.size; i++) result.add(saves.get(i).index);
|
||||
|
||||
Core.settings.put("save-slots", result);
|
||||
Core.settings.putObject("save-slots", result);
|
||||
Core.settings.save();
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
package io.anuke.mindustry.graphics;
|
||||
|
||||
import io.anuke.arc.Core;
|
||||
import io.anuke.arc.Events;
|
||||
import io.anuke.arc.collection.Array;
|
||||
import io.anuke.arc.collection.IntSet;
|
||||
@@ -58,7 +57,7 @@ public class BlockRenderer{
|
||||
|
||||
public void drawShadows(){
|
||||
Draw.color(0, 0, 0, 0.15f);
|
||||
Draw.rect().tex(shadows.getTexture()).center(
|
||||
Draw.rect(Draw.wrap(shadows.getTexture()),
|
||||
camera.position.x - camera.position.x % tilesize,
|
||||
camera.position.y - camera.position.y % tilesize,
|
||||
shadows.getWidth(), -shadows.getHeight());
|
||||
@@ -90,7 +89,7 @@ public class BlockRenderer{
|
||||
requestidx = 0;
|
||||
|
||||
Draw.flush();
|
||||
Core.graphics.batch().getProjection()
|
||||
Draw.proj()
|
||||
.setOrtho(Mathf.round(camera.position.x, tilesize)-shadowW/2f, Mathf.round(camera.position.y, tilesize)-shadowH/2f,
|
||||
shadowW, shadowH);
|
||||
|
||||
@@ -141,7 +140,7 @@ public class BlockRenderer{
|
||||
shadows.end();
|
||||
|
||||
Draw.flush();
|
||||
Draw.projection(camera.projection());
|
||||
Draw.proj(camera.projection());
|
||||
|
||||
Sort.instance().sort(requests.items, 0, requestidx);
|
||||
|
||||
|
||||
@@ -7,11 +7,9 @@ import io.anuke.arc.collection.IntSet;
|
||||
import io.anuke.arc.collection.IntSet.IntSetIterator;
|
||||
import io.anuke.arc.collection.ObjectSet;
|
||||
import io.anuke.arc.graphics.Camera;
|
||||
import io.anuke.arc.graphics.Color;
|
||||
import io.anuke.arc.graphics.GL20;
|
||||
import io.anuke.arc.graphics.g2d.CacheBatch;
|
||||
import io.anuke.arc.graphics.g2d.Draw;
|
||||
import io.anuke.arc.graphics.g2d.Fill;
|
||||
import io.anuke.arc.graphics.g2d.SpriteBatch;
|
||||
import io.anuke.arc.math.Mathf;
|
||||
import io.anuke.arc.util.Log;
|
||||
@@ -145,12 +143,6 @@ public class FloorRenderer{
|
||||
layer.end();
|
||||
}
|
||||
|
||||
private void fillChunk(float x, float y){
|
||||
Draw.color(Color.BLACK);
|
||||
Fill.rect().set(x, y, chunksize * tilesize, chunksize * tilesize);
|
||||
Draw.color();
|
||||
}
|
||||
|
||||
private void cacheChunk(int cx, int cy){
|
||||
Chunk chunk = cache[cx][cy];
|
||||
|
||||
@@ -174,8 +166,10 @@ public class FloorRenderer{
|
||||
}
|
||||
|
||||
private void cacheChunkLayer(int cx, int cy, Chunk chunk, CacheLayer layer){
|
||||
SpriteBatch current = Core.graphics.batch();
|
||||
Core.graphics.useBatch(cbatch);
|
||||
SpriteBatch current = Core.batch;
|
||||
Core.batch = cbatch;
|
||||
|
||||
cbatch.beginCache();
|
||||
|
||||
for(int tilex = cx * chunksize; tilex < (cx + 1) * chunksize; tilex++){
|
||||
for(int tiley = cy * chunksize; tiley < (cy + 1) * chunksize; tiley++){
|
||||
@@ -195,8 +189,8 @@ public class FloorRenderer{
|
||||
}
|
||||
}
|
||||
}
|
||||
Core.graphics.useBatch(current);
|
||||
chunk.caches[layer.ordinal()] = cbatch.flushCache();
|
||||
Core.batch = current;
|
||||
chunk.caches[layer.ordinal()] = cbatch.endCache();
|
||||
}
|
||||
|
||||
public void clearTiles(){
|
||||
|
||||
@@ -8,6 +8,7 @@ import io.anuke.arc.graphics.Pixmap.Format;
|
||||
import io.anuke.arc.graphics.Pixmaps;
|
||||
import io.anuke.arc.graphics.Texture;
|
||||
import io.anuke.arc.graphics.g2d.Draw;
|
||||
import io.anuke.arc.graphics.g2d.Fill;
|
||||
import io.anuke.arc.graphics.g2d.ScissorStack;
|
||||
import io.anuke.arc.graphics.g2d.TextureRegion;
|
||||
import io.anuke.arc.math.Mathf;
|
||||
@@ -81,7 +82,7 @@ public class MinimapRenderer implements Disposable{
|
||||
for(Unit unit : units){
|
||||
float rx = (unit.x - rect.x) / rect.width * w, ry = (unit.y - rect.y) / rect.width * h;
|
||||
Draw.color(unit.getTeam().color);
|
||||
Draw.rect().tex(Core.atlas.white()).set(x + rx, y + ry, w / (sz * 2), h / (sz * 2));
|
||||
Fill.crect(x + rx, y + ry, w / (sz * 2), h / (sz * 2));
|
||||
}
|
||||
|
||||
Draw.color();
|
||||
|
||||
@@ -26,14 +26,13 @@ public class Shapes{
|
||||
|
||||
TextureRegion region = Core.atlas.find(edge);
|
||||
|
||||
Draw.rect(edge, x, y, region.getWidth() * Draw.scl, region.getHeight() * scale * Draw.scl).rot(rotation + 180);
|
||||
Draw.rect(Core.atlas.find(edge), x, y, region.getWidth() * Draw.scl, region.getHeight() * scale * Draw.scl, rotation + 180);
|
||||
|
||||
Draw.rect(edge, x2, y2, region.getWidth() * Draw.scl, region.getHeight() * scale * Draw.scl).rot(rotation);
|
||||
Draw.rect(Core.atlas.find(edge), x2, y2, region.getWidth() * Draw.scl, region.getHeight() * scale * Draw.scl, rotation);
|
||||
}
|
||||
|
||||
public static void tri(float x, float y, float width, float length, float rotation){
|
||||
float oy = 17f / 63f * length;
|
||||
Core.graphics.batch().draw().tex(Core.atlas.find("shape-3")).pos(x - width / 2f, y - oy)
|
||||
.origin(width / 2f, oy).size(width, length).rot(rotation - 90);
|
||||
Draw.rect(Core.atlas.find("shape-3"), x, y - oy + length/2f, width, length, width / 2f, oy, rotation - 90);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -49,7 +49,7 @@ public class DesktopInput extends InputHandler{
|
||||
|
||||
for(TextureRegion region : regions){
|
||||
Draw.rect(region, x * tilesize + block.offset(), y * tilesize + block.offset(),
|
||||
region.getWidth() * selectScale, region.getHeight() * selectScale).rot(block.rotate ? rotation * 90 : 0);
|
||||
region.getWidth() * selectScale, region.getHeight() * selectScale, block.rotate ? rotation * 90 : 0);
|
||||
}
|
||||
}else{
|
||||
Draw.color(Palette.removeBack);
|
||||
@@ -79,8 +79,10 @@ public class DesktopInput extends InputHandler{
|
||||
|
||||
if(i + recipe.result.size > result.getLength() && recipe.result.rotate){
|
||||
Draw.color(!validPlace(x, y, recipe.result, result.rotation) ? Palette.remove : Palette.placeRotate);
|
||||
Draw.rect("place-arrow", x * tilesize + recipe.result.offset(),
|
||||
y * tilesize + recipe.result.offset()).origin(x * tilesize + recipe.result.offset()/2f, 0f).rot(result.rotation * 90 - 90);
|
||||
Draw.rect(Core.atlas.find("place-arrow"), x * tilesize + recipe.result.offset(),
|
||||
y * tilesize + recipe.result.offset(),
|
||||
Core.atlas.find("place-arrow").getWidth() * Draw.scl, Core.atlas.find("place-arrow").getHeight() * Draw.scl,
|
||||
x * tilesize + recipe.result.offset()/2f, 0f, result.rotation * 90 - 90);
|
||||
}
|
||||
|
||||
drawPlace(x, y, recipe.result, result.rotation);
|
||||
@@ -111,8 +113,11 @@ public class DesktopInput extends InputHandler{
|
||||
}else if(isPlacing()){
|
||||
if(recipe.result.rotate){
|
||||
Draw.color(!validPlace(cursorX, cursorY, recipe.result, rotation) ? Palette.remove : Palette.placeRotate);
|
||||
Draw.rect("place-arrow", cursorX * tilesize + recipe.result.offset(),
|
||||
cursorY * tilesize + recipe.result.offset()).origin(cursorX * tilesize + recipe.result.offset()/2f, 0).rot(rotation * 90 - 90);
|
||||
Draw.rect(Core.atlas.find("place-arrow"), cursorX * tilesize + recipe.result.offset(),
|
||||
cursorY * tilesize + recipe.result.offset(),
|
||||
Core.atlas.find("place-arrow").getWidth() * Draw.scl,
|
||||
Core.atlas.find("place-arrow").getHeight() * Draw.scl,
|
||||
cursorX * tilesize + recipe.result.offset()/2f, 0, rotation * 90 - 90);
|
||||
}
|
||||
drawPlace(cursorX, cursorY, recipe.result, rotation);
|
||||
recipe.result.drawPlace(cursorX, cursorY, rotation, validPlace(cursorX, cursorY, recipe.result, rotation));
|
||||
|
||||
@@ -178,8 +178,8 @@ public class MobileInput extends InputHandler implements GestureListener{
|
||||
|
||||
for(TextureRegion region : regions){
|
||||
Draw.rect(region, tile.worldx() + offset, tile.worldy() + offset,
|
||||
region.getWidth() * request.scale, region.getHeight() * request.scale)
|
||||
.rot(request.recipe.result.rotate ? request.rotation * 90 : 0);
|
||||
region.getWidth() * request.scale, region.getHeight() * request.scale,
|
||||
request.recipe.result.rotate ? request.rotation * 90 : 0);
|
||||
}
|
||||
}else{
|
||||
float rad = (tile.block().size * tilesize / 2f - 1) * request.scale;
|
||||
@@ -346,8 +346,7 @@ public class MobileInput extends InputHandler implements GestureListener{
|
||||
|
||||
for(TextureRegion region : regions){
|
||||
Draw.rect(region, x * tilesize + recipe.result.offset(), y * tilesize + recipe.result.offset(),
|
||||
region.getWidth() * lineScale, region.getHeight() * lineScale)
|
||||
.rot(recipe.result.rotate ? result.rotation * 90 : 0);
|
||||
region.getWidth() * lineScale, region.getHeight() * lineScale, recipe.result.rotate ? result.rotation * 90 : 0);
|
||||
}
|
||||
}else{
|
||||
Draw.color(Palette.removeBack);
|
||||
|
||||
@@ -42,18 +42,18 @@ public class BlockLocMission extends Mission{
|
||||
|
||||
if(block.rotate){
|
||||
Draw.colorl(0.4f);
|
||||
Draw.rect("icon-arrow", x * tilesize + block.offset(), y * tilesize + block.offset() - 1f).rot(rotation*90);
|
||||
Draw.rect(Core.atlas.find("icon-arrow"), x * tilesize + block.offset(), y * tilesize + block.offset() - 1f, rotation*90);
|
||||
Draw.colorl(0.6f);
|
||||
Draw.rect("icon-arrow", x * tilesize + block.offset(), y * tilesize + block.offset()).rot(rotation*90);
|
||||
Draw.rect(Core.atlas.find("icon-arrow"), x * tilesize + block.offset(), y * tilesize + block.offset(), rotation*90);
|
||||
}
|
||||
|
||||
float rot = players[0].angleTo(x * tilesize + block.offset(), y * tilesize + block.offset());
|
||||
float len = 12f;
|
||||
|
||||
Draw.color(Palette.accentBack);
|
||||
Draw.rect("icon-arrow", players[0].x + Angles.trnsx(rot, len), players[0].y + Angles.trnsy(rot, len)).rot(rot);
|
||||
Draw.rect(Core.atlas.find("icon-arrow"), players[0].x + Angles.trnsx(rot, len), players[0].y + Angles.trnsy(rot, len), rot);
|
||||
Draw.color(Palette.accent);
|
||||
Draw.rect("icon-arrow", players[0].x + Angles.trnsx(rot, len), players[0].y + Angles.trnsy(rot, len) + 1f).rot(rot);
|
||||
Draw.rect(Core.atlas.find("icon-arrow"), players[0].x + Angles.trnsx(rot, len), players[0].y + Angles.trnsy(rot, len) + 1f, rot);
|
||||
|
||||
Draw.reset();
|
||||
}
|
||||
|
||||
@@ -23,11 +23,11 @@ public class GridImage extends Element{
|
||||
int jumpy = (int) (Math.max(minspace, yspace) / yspace);
|
||||
|
||||
for(int x = 0; x <= imageWidth; x += jumpx){
|
||||
Fill.rect().set((int) (getX() + xspace * x - s), getY() - s, 2, getHeight() + (x == imageWidth ? 1 : 0));
|
||||
Fill.crect((int) (getX() + xspace * x - s), getY() - s, 2, getHeight() + (x == imageWidth ? 1 : 0));
|
||||
}
|
||||
|
||||
for(int y = 0; y <= imageHeight; y += jumpy){
|
||||
Fill.rect().set(getX() - s, (int) (getY() + y * yspace - s), getWidth(), 2);
|
||||
Fill.crect(getX() - s, (int) (getY() + y * yspace - s), getWidth(), 2);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@ public class Minimap extends Container<Element>{
|
||||
public void draw(){
|
||||
if(renderer.minimap.getRegion() == null) return;
|
||||
|
||||
Draw.rect().tex(renderer.minimap.getRegion()).set(x, y, width, height);
|
||||
Draw.rect(renderer.minimap.getRegion(), x + width/2f, y + height/2f, width, height);
|
||||
|
||||
if(renderer.minimap.getTexture() != null){
|
||||
renderer.minimap.drawEntities(x, y, width, height);
|
||||
|
||||
@@ -99,7 +99,7 @@ public class GenViewDialog extends FloatingDialog{
|
||||
float drawX = x + width/2f+ wx * padSectorSize - tx * padSectorSize - panX % padSectorSize;
|
||||
float drawY = y + height/2f + wy * padSectorSize - ty * padSectorSize - panY % padSectorSize;
|
||||
|
||||
Draw.rect().tex(map.get(wx, wy)).set(drawX, drawY, padSectorSize, padSectorSize);
|
||||
Draw.rect(Draw.wrap(map.get(wx, wy)), drawX + padSectorSize/2f, drawY + padSectorSize/2f, padSectorSize, padSectorSize);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -202,13 +202,13 @@ public class SectorsDialog extends FloatingDialog{
|
||||
|
||||
if(sector == null || sector.texture == null){
|
||||
Draw.reset();
|
||||
Draw.rect("empty-sector", drawX, drawY, sectorSize, sectorSize);
|
||||
Draw.rect(("empty-sector"), drawX, drawY, sectorSize, sectorSize);
|
||||
|
||||
int i = 0;
|
||||
for(Point2 point : Geometry.d4){
|
||||
Sector other = world.sectors.get(sectorX + point.x, sectorY + point.y);
|
||||
if(other != null){
|
||||
Draw.rect("sector-edge", drawX, drawY, sectorSize, sectorSize).rot(i*90);
|
||||
Draw.rect(("sector-edge"), drawX, drawY, sectorSize, sectorSize, i*90);
|
||||
}
|
||||
|
||||
i ++;
|
||||
@@ -217,7 +217,7 @@ public class SectorsDialog extends FloatingDialog{
|
||||
}
|
||||
|
||||
Draw.colorl(!sector.complete ? 0.3f : 1f);
|
||||
Draw.rect().tex(sector.texture).center(drawX, drawY, sectorSize, sectorSize);
|
||||
Draw.rect(Draw.wrap(sector.texture), drawX, drawY, sectorSize, sectorSize);
|
||||
|
||||
if(sector.missions.size == 0) continue;
|
||||
|
||||
@@ -250,16 +250,16 @@ public class SectorsDialog extends FloatingDialog{
|
||||
}
|
||||
|
||||
Draw.color(selectColor);
|
||||
Draw.rect("sector-select", drawX, drawY, sectorSize, sectorSize);
|
||||
Draw.rect(("sector-select"), drawX, drawY, sectorSize, sectorSize);
|
||||
|
||||
Draw.color(backColor);
|
||||
Draw.alpha(0.75f * backColor.a);
|
||||
Draw.rect("icon-mission-background", drawX, drawY, Unit.dp.scl(18f * 5), Unit.dp.scl(18f * 5));
|
||||
Draw.rect(("icon-mission-background"), drawX, drawY, Unit.dp.scl(18f * 5), Unit.dp.scl(18f * 5));
|
||||
|
||||
float size = Unit.dp.scl(10f * 5);
|
||||
|
||||
Draw.color(iconColor);
|
||||
Draw.rect(region, drawX, drawY, size, size);
|
||||
Draw.rect((region), drawX, drawY, size, size);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -7,7 +7,6 @@ import io.anuke.arc.graphics.g2d.TextureRegion;
|
||||
import io.anuke.arc.scene.Group;
|
||||
import io.anuke.arc.scene.ui.layout.Unit;
|
||||
import io.anuke.mindustry.core.GameState.State;
|
||||
import io.anuke.mindustry.graphics.Palette;
|
||||
import io.anuke.mindustry.graphics.Shaders;
|
||||
|
||||
import static io.anuke.mindustry.Vars.state;
|
||||
@@ -18,12 +17,10 @@ public class BackgroundFragment extends Fragment{
|
||||
public void build(Group parent){
|
||||
Core.scene.table().addRect((a, b, w, h) -> {
|
||||
Draw.colorl(0.1f);
|
||||
Fill.rect().set(0, 0, w, h);
|
||||
Draw.color(Palette.accent);
|
||||
Fill.rect(0, 0, w, h);
|
||||
Draw.shader(Shaders.menu);
|
||||
Fill.rect().set(0, 0, w, h);
|
||||
Fill.rect(0, 0, w, h);
|
||||
Draw.shader();
|
||||
Draw.color();
|
||||
|
||||
boolean portrait = Core.graphics.getWidth() < Core.graphics.getHeight();
|
||||
float logoscl = (int) Unit.dp.scl(7) * (portrait ? 5f / 7f : 1f);
|
||||
@@ -32,7 +29,7 @@ public class BackgroundFragment extends Fragment{
|
||||
float logoh = logo.getHeight() * logoscl;
|
||||
|
||||
Draw.color();
|
||||
Draw.rect().tex(logo).set((int) (w / 2 - logow / 2), (int) (h - logoh + 15 - Unit.dp.scl(portrait ? 30f : 0)), logow, logoh);
|
||||
Draw.rect(logo, (int) (w / 2 - logow / 2), (int) (h - logoh + 15 - Unit.dp.scl(portrait ? 30f : 0)), logow, logoh);
|
||||
}).visible(() -> state.is(State.menu)).grow();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -158,7 +158,7 @@ public class ChatFragment extends Table{
|
||||
Draw.color(shadowColor);
|
||||
|
||||
if(chatOpen){
|
||||
Fill.rect().set(offsetx, chatfield.getY(), chatfield.getWidth() + 15f, chatfield.getHeight() - 1);
|
||||
Fill.crect(offsetx, chatfield.getY(), chatfield.getWidth() + 15f, chatfield.getHeight() - 1);
|
||||
}
|
||||
|
||||
super.draw();
|
||||
@@ -185,7 +185,7 @@ public class ChatFragment extends Table{
|
||||
Draw.color(0, 0, 0, shadowColor.a * (fadetime - i));
|
||||
}
|
||||
|
||||
Fill.rect().set(offsetx, theight - layout.height - 2, textWidth + Unit.dp.scl(4f), layout.height + textspacing);
|
||||
Fill.crect(offsetx, theight - layout.height - 2, textWidth + Unit.dp.scl(4f), layout.height + textspacing);
|
||||
Draw.color(shadowColor);
|
||||
|
||||
font.getCache().draw();
|
||||
|
||||
@@ -509,7 +509,7 @@ public class Block extends BaseBlock {
|
||||
}
|
||||
|
||||
public void draw(Tile tile){
|
||||
Draw.rect(region, tile.drawx(), tile.drawy()).rot(rotate ? tile.getRotation() * 90 : 0);
|
||||
Draw.rect(region, tile.drawx(), tile.drawy(), rotate ? tile.getRotation() * 90 : 0);
|
||||
}
|
||||
|
||||
public void drawNonLayer(Tile tile){
|
||||
|
||||
@@ -129,7 +129,7 @@ public class BuildBlock extends Block{
|
||||
if(entity.previous == null) return;
|
||||
|
||||
for(TextureRegion region : entity.previous.getBlockIcon()){
|
||||
Draw.rect(region, tile.drawx(), tile.drawy()).rot(entity.previous.rotate ? tile.getRotation() * 90 : 0);
|
||||
Draw.rect(region, tile.drawx(), tile.drawy(), entity.previous.rotate ? tile.getRotation() * 90 : 0);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -149,7 +149,7 @@ public class BuildBlock extends Block{
|
||||
Shaders.blockbuild.progress = entity.progress;
|
||||
Shaders.blockbuild.apply();
|
||||
|
||||
Draw.rect(region, tile.drawx(), tile.drawy()).rot(target.rotate ? tile.getRotation() * 90 : 0);
|
||||
Draw.rect(region, tile.drawx(), tile.drawy(), target.rotate ? tile.getRotation() * 90 : 0);
|
||||
Draw.flush();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -141,13 +141,13 @@ public class Floor extends Block{
|
||||
boolean above = (tile.getCliffs() & (1 << ((i + 1) % 4) * 2)) != 0, below = (tile.getCliffs() & (1 << (Mathf.mod(i - 1, 4)) * 2)) != 0;
|
||||
|
||||
if(above && below){
|
||||
Draw.rect(cliffRegions[0], tile.worldx(), tile.worldy()).rot(i * 90);
|
||||
Draw.rect(cliffRegions[0], tile.worldx(), tile.worldy(), i * 90);
|
||||
}else if(above){
|
||||
Draw.rect(cliffRegions[1], tile.worldx(), tile.worldy()).rot(i * 90);
|
||||
Draw.rect(cliffRegions[1], tile.worldx(), tile.worldy(), i * 90);
|
||||
}else if(below){
|
||||
Draw.rect(cliffRegions[2], tile.worldx(), tile.worldy()).rot(i * 90);
|
||||
Draw.rect(cliffRegions[2], tile.worldx(), tile.worldy(), i * 90);
|
||||
}else{
|
||||
Draw.rect(cliffRegions[3], tile.worldx(), tile.worldy()).rot(i * 90);
|
||||
Draw.rect(cliffRegions[3], tile.worldx(), tile.worldy(), i * 90);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -178,7 +178,7 @@ public class Floor extends Block{
|
||||
|
||||
TextureRegion region = floor.edgeRegions[i];
|
||||
|
||||
Draw.rect().tex(region).set(tile.worldx() + floor.offsets[i].x, tile.worldy() + floor.offsets[i].y, region.getWidth(), region.getHeight());
|
||||
Draw.rect(region, tile.worldx() + floor.offsets[i].x, tile.worldy() + floor.offsets[i].y, region.getWidth(), region.getHeight());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -40,15 +40,15 @@ public class LiquidBlock extends Block{
|
||||
|
||||
int rotation = rotate ? tile.getRotation() * 90 : 0;
|
||||
|
||||
Draw.rect(bottomRegion, tile.drawx(), tile.drawy()).rot(rotation);
|
||||
Draw.rect(bottomRegion, tile.drawx(), tile.drawy(), rotation);
|
||||
|
||||
if(mod.total() > 0.001f){
|
||||
Draw.color(mod.current().color);
|
||||
Draw.alpha(mod.total() / liquidCapacity);
|
||||
Draw.rect(liquidRegion, tile.drawx(), tile.drawy()).rot(rotation);
|
||||
Draw.rect(liquidRegion, tile.drawx(), tile.drawy(), rotation);
|
||||
Draw.color();
|
||||
}
|
||||
|
||||
Draw.rect(topRegion, tile.drawx(), tile.drawy()).rot(rotation);
|
||||
Draw.rect(topRegion, tile.drawx(), tile.drawy(), rotation);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -36,7 +36,9 @@ public class DeflectorWall extends Wall{
|
||||
|
||||
Draw.color(Color.WHITE);
|
||||
Draw.alpha(entity.hit * 0.5f);
|
||||
Draw.rect("blank", tile.drawx(), tile.drawy(), tilesize * size, tilesize * size).blend(Blending.additive);
|
||||
Draw.blend(Blending.additive);
|
||||
Draw.rect("blank", tile.drawx(), tile.drawy(), tilesize * size, tilesize * size);
|
||||
Draw.blend();
|
||||
Draw.reset();
|
||||
|
||||
entity.hit = Mathf.clamp(entity.hit - Time.delta() / hitTime);
|
||||
|
||||
@@ -175,7 +175,9 @@ public class ForceProjector extends Block {
|
||||
|
||||
if(entity.buildup <= 0f) return;
|
||||
Draw.alpha(entity.buildup / breakage * 0.75f);
|
||||
Draw.rect(topRegion, tile.drawx(), tile.drawy()).blend(Blending.additive);
|
||||
Draw.blend(Blending.additive);
|
||||
Draw.rect(topRegion, tile.drawx(), tile.drawy());
|
||||
Draw.blend();
|
||||
Draw.reset();
|
||||
}
|
||||
|
||||
|
||||
@@ -112,7 +112,9 @@ public class MendProjector extends Block{
|
||||
|
||||
Draw.color(color, phase, entity.phaseHeat);
|
||||
Draw.alpha(entity.heat * Mathf.absin(Time.time(), 10f, 1f) * 0.5f);
|
||||
Draw.rect(topRegion, tile.drawx(), tile.drawy()).blend(Blending.additive);
|
||||
Draw.blend(Blending.additive);
|
||||
Draw.rect(topRegion, tile.drawx(), tile.drawy());
|
||||
Draw.blend();
|
||||
|
||||
Draw.alpha(1f);
|
||||
Lines.stroke((2f * f + 0.2f)* entity.heat);
|
||||
|
||||
@@ -115,7 +115,9 @@ public class OverdriveProjector extends Block{
|
||||
|
||||
Draw.color(color, phase, entity.phaseHeat);
|
||||
Draw.alpha(entity.heat * Mathf.absin(Time.time(), 10f, 1f) * 0.5f);
|
||||
Draw.rect(topRegion, tile.drawx(), tile.drawy()).blend(Blending.additive);
|
||||
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.circle(tile.drawx(), tile.drawy(), (1f-f) * 9f);
|
||||
|
||||
@@ -34,7 +34,7 @@ public class ShockMine extends Block{
|
||||
super.draw(tile);
|
||||
Draw.color(tile.getTeam().color);
|
||||
Draw.alpha(0.22f);
|
||||
Fill.rect().center(tile.drawx(), tile.drawy(), 2f, 2f);
|
||||
Fill.rect(tile.drawx(), tile.drawy(), 2f, 2f);
|
||||
Draw.color();
|
||||
}
|
||||
|
||||
|
||||
@@ -75,10 +75,14 @@ public abstract class Turret extends Block{
|
||||
protected TextureRegion baseTopRegion;
|
||||
|
||||
protected BiConsumer<Tile, TurretEntity> drawer = (tile, entity) ->
|
||||
Draw.rect(region, tile.drawx() + tr2.x, tile.drawy() + tr2.y).rot(entity.rotation - 90);
|
||||
Draw.rect(region, tile.drawx() + tr2.x, tile.drawy() + tr2.y, entity.rotation - 90);
|
||||
protected BiConsumer<Tile, TurretEntity> heatDrawer = (tile, entity) -> {
|
||||
if(entity.heat <= 0.00001f) return;
|
||||
Draw.rect(heatRegion, tile.drawx() + tr2.x, tile.drawy() + tr2.y).rot(entity.rotation - 90).color(heatColor, entity.heat).blend(Blending.additive);
|
||||
Draw.color(heatColor, entity.heat);
|
||||
Draw.blend(Blending.additive);
|
||||
Draw.rect(heatRegion, tile.drawx() + tr2.x, tile.drawy() + tr2.y, entity.rotation - 90);
|
||||
Draw.blend();
|
||||
Draw.color();
|
||||
};
|
||||
|
||||
public Turret(String name){
|
||||
@@ -129,7 +133,8 @@ public abstract class Turret extends Block{
|
||||
@Override
|
||||
public void draw(Tile tile){
|
||||
Draw.rect(baseRegion, tile.drawx(), tile.drawy());
|
||||
Draw.rect(baseTopRegion, tile.drawx(), tile.drawy()).color(tile.getTeam().color, Color.WHITE, 0.45f);
|
||||
Draw.color(tile.getTeam().color, Color.WHITE, 0.45f);
|
||||
Draw.rect(baseTopRegion, tile.drawx(), tile.drawy());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -45,7 +45,7 @@ public class Conduit extends LiquidBlock{
|
||||
if(entity.blendshadowrot == -1){
|
||||
super.drawShadow(tile);
|
||||
}else{
|
||||
Draw.rect("shadow-corner", tile.drawx(), tile.drawy()).rot((tile.getRotation() + 3 + entity.blendshadowrot) * 90);
|
||||
Draw.rect(Core.atlas.find("shadow-corner"), tile.drawx(), tile.drawy(), (tile.getRotation() + 3 + entity.blendshadowrot) * 90);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -88,14 +88,14 @@ public class Conduit extends LiquidBlock{
|
||||
int rotation = tile.getRotation() * 90;
|
||||
|
||||
Draw.colorl(0.34f);
|
||||
Draw.rect(botRegions[entity.blendbits], tile.drawx(), tile.drawy()).rot(rotation);
|
||||
Draw.rect(botRegions[entity.blendbits], tile.drawx(), tile.drawy(), rotation);
|
||||
|
||||
Draw.color(mod.current().color);
|
||||
Draw.alpha(entity.smoothLiquid);
|
||||
Draw.rect(botRegions[entity.blendbits], tile.drawx(), tile.drawy()).rot(rotation);
|
||||
Draw.rect(botRegions[entity.blendbits], tile.drawx(), tile.drawy(), rotation);
|
||||
Draw.color();
|
||||
|
||||
Draw.rect(topRegions[entity.blendbits], tile.drawx(), tile.drawy()).rot(rotation);
|
||||
Draw.rect(topRegions[entity.blendbits], tile.drawx(), tile.drawy(), rotation);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -91,7 +91,7 @@ public class Conveyor extends Block{
|
||||
if(entity.blendshadowrot == -1){
|
||||
super.drawShadow(tile);
|
||||
}else{
|
||||
Draw.rect("shadow-corner", tile.drawx(), tile.drawy()).rot((tile.getRotation() + 3 + entity.blendshadowrot) * 90);
|
||||
Draw.rect(Core.atlas.find("shadow-corner"), tile.drawx(), tile.drawy(), (tile.getRotation() + 3 + entity.blendshadowrot) * 90);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -102,7 +102,7 @@ public class Conveyor extends Block{
|
||||
|
||||
int frame = entity.clogHeat <= 0.5f ? (int) (((Time.time() * speed * 8f * entity.timeScale)) % 4) : 0;
|
||||
Draw.rect(regions[Mathf.clamp(entity.blendbits, 0, regions.length - 1)][Mathf.clamp(frame, 0, regions[0].length - 1)], tile.drawx(), tile.drawy(),
|
||||
tilesize * entity.blendsclx, tilesize * entity.blendscly).rot( rotation*90);
|
||||
tilesize * entity.blendsclx, tilesize * entity.blendscly, rotation*90);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -39,10 +39,10 @@ public class ExtendingItemBridge extends ItemBridge{
|
||||
tile.worldx() + ex,
|
||||
tile.worldy() + ey, CapStyle.none, 0f);
|
||||
|
||||
Draw.rect(endRegion, tile.drawx(), tile.drawy()).rot(i * 90 + 90);
|
||||
Draw.rect(endRegion, tile.drawx(), tile.drawy(), i * 90 + 90);
|
||||
Draw.rect(endRegion,
|
||||
tile.worldx() + ex + Geometry.d4[i].x * tilesize / 2f,
|
||||
tile.worldy() + ey + Geometry.d4[i].y * tilesize / 2f).rot(i * 90 + 270);
|
||||
tile.worldy() + ey + Geometry.d4[i].y * tilesize / 2f, i * 90 + 270);
|
||||
|
||||
int dist = Math.max(Math.abs(other.x - tile.x), Math.abs(other.y - tile.y));
|
||||
|
||||
@@ -54,8 +54,7 @@ public class ExtendingItemBridge extends ItemBridge{
|
||||
Draw.alpha(Mathf.absin(a / (float) arrows - entity.time / 100f, 0.1f, 1f) * entity.uptime);
|
||||
Draw.rect(arrowRegion,
|
||||
tile.worldx() + Geometry.d4[i].x * (tilesize / 2f + a * 6f + 2) * entity.uptime,
|
||||
tile.worldy() + Geometry.d4[i].y * (tilesize / 2f + a * 6f + 2) * entity.uptime)
|
||||
.rot(i * 90f);
|
||||
tile.worldy() + Geometry.d4[i].y * (tilesize / 2f + a * 6f + 2) * entity.uptime, i * 90f);
|
||||
}
|
||||
Draw.reset();
|
||||
}
|
||||
|
||||
@@ -216,8 +216,8 @@ public class ItemBridge extends Block{
|
||||
Draw.color(Color.WHITE, Color.BLACK, Mathf.absin(Time.time(), 6f, 0.07f));
|
||||
Draw.alpha(Math.max(entity.uptime, 0.25f));
|
||||
|
||||
Draw.rect(endRegion, tile.drawx(), tile.drawy()).rot(i * 90 + 90);
|
||||
Draw.rect(endRegion, other.drawx(), other.drawy()).rot(i * 90 + 270);
|
||||
Draw.rect(endRegion, tile.drawx(), tile.drawy(), i * 90 + 90);
|
||||
Draw.rect(endRegion, other.drawx(), other.drawy(), i * 90 + 270);
|
||||
|
||||
Lines.stroke(8f);
|
||||
Lines.line(bridgeRegion,
|
||||
@@ -237,7 +237,7 @@ public class ItemBridge extends Block{
|
||||
Draw.alpha(Mathf.absin(a / (float) arrows - entity.time / 100f, 0.1f, 1f) * entity.uptime);
|
||||
Draw.rect(arrowRegion,
|
||||
tile.worldx() + Geometry.d4[i].x * (tilesize / 2f + a * 4f + time % 4f),
|
||||
tile.worldy() + Geometry.d4[i].y * (tilesize / 2f + a * 4f + time % 4f)).rot(i * 90f);
|
||||
tile.worldy() + Geometry.d4[i].y * (tilesize / 2f + a * 4f + time % 4f), i * 90f);
|
||||
}
|
||||
Draw.reset();
|
||||
}
|
||||
|
||||
@@ -191,8 +191,7 @@ public class MassDriver extends Block{
|
||||
|
||||
Draw.rect(turretRegion,
|
||||
tile.drawx() + Angles.trnsx(entity.rotation + 180f, entity.reload * knockback),
|
||||
tile.drawy() + Angles.trnsy(entity.rotation + 180f, entity.reload * knockback))
|
||||
.rot(entity.rotation - 90);
|
||||
tile.drawy() + Angles.trnsy(entity.rotation + 180f, entity.reload * knockback), entity.rotation - 90);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package io.anuke.mindustry.world.blocks.power;
|
||||
|
||||
import io.anuke.arc.Core;
|
||||
import io.anuke.arc.Graphics;
|
||||
import io.anuke.arc.graphics.Blending;
|
||||
import io.anuke.arc.graphics.Color;
|
||||
import io.anuke.arc.graphics.g2d.Draw;
|
||||
@@ -85,7 +84,9 @@ public class FusionReactor extends PowerGenerator{
|
||||
|
||||
Draw.color(plasma1, plasma2, (float) i / plasmas);
|
||||
Draw.alpha((0.3f + Mathf.absin(Time.time(), 2f + i * 2f, 0.3f + i * 0.05f)) * entity.warmup);
|
||||
Draw.rect(name + "-plasma-" + i, tile.drawx(), tile.drawy(), r, r).rot(Time.time() * (12 + i * 6f) * entity.warmup).blend(Blending.additive);
|
||||
Draw.blend(Blending.additive);
|
||||
Draw.rect(name + "-plasma-" + i, tile.drawx(), tile.drawy(), r, r, Time.time() * (12 + i * 6f) * entity.warmup);
|
||||
Draw.blend();
|
||||
}
|
||||
|
||||
Draw.color();
|
||||
|
||||
@@ -97,11 +97,13 @@ public class Drill extends Block{
|
||||
if(drawRim){
|
||||
Draw.color(heatColor);
|
||||
Draw.alpha(entity.warmup * ts * (1f - s + Mathf.absin(Time.time(), 3f, s)));
|
||||
Draw.rect(rimRegion, tile.drawx(), tile.drawy()).blend(Blending.additive);
|
||||
Draw.blend(Blending.additive);
|
||||
Draw.rect(rimRegion, tile.drawx(), tile.drawy());
|
||||
Draw.blend();
|
||||
Draw.color();
|
||||
}
|
||||
|
||||
Draw.rect(rotatorRegion, tile.drawx(), tile.drawy()).rot(entity.drillTime * rotateSpeed);
|
||||
Draw.rect(rotatorRegion, tile.drawx(), tile.drawy(), entity.drillTime * rotateSpeed);
|
||||
|
||||
Draw.rect(topRegion, tile.drawx(), tile.drawy());
|
||||
|
||||
|
||||
@@ -44,7 +44,7 @@ public class Fracker extends SolidPump{
|
||||
Draw.rect(liquidRegion, tile.drawx(), tile.drawy());
|
||||
Draw.color();
|
||||
|
||||
Draw.rect(rotatorRegion, tile.drawx(), tile.drawy()).rot(entity.pumpTime);
|
||||
Draw.rect(rotatorRegion, tile.drawx(), tile.drawy(), entity.pumpTime);
|
||||
Draw.rect(topRegion, tile.drawx(), tile.drawy());
|
||||
}
|
||||
|
||||
|
||||
@@ -78,16 +78,16 @@ public class LiquidMixer extends LiquidBlock{
|
||||
|
||||
int rotation = rotate ? tile.getRotation() * 90 : 0;
|
||||
|
||||
Draw.rect(bottomRegion, tile.drawx(), tile.drawy()).rot(rotation);
|
||||
Draw.rect(bottomRegion, tile.drawx(), tile.drawy(), rotation);
|
||||
|
||||
if(mod.total() > 0.001f){
|
||||
Draw.color(outputLiquid.color);
|
||||
Draw.alpha(mod.get(outputLiquid) / liquidCapacity);
|
||||
Draw.rect(liquidRegion, tile.drawx(), tile.drawy()).rot(rotation);
|
||||
Draw.rect(liquidRegion, tile.drawx(), tile.drawy(), rotation);
|
||||
Draw.color();
|
||||
}
|
||||
|
||||
Draw.rect(topRegion, tile.drawx(), tile.drawy()).rot(rotation);
|
||||
Draw.rect(topRegion, tile.drawx(), tile.drawy(), rotation);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -50,7 +50,7 @@ public class PhaseWeaver extends PowerSmelter{
|
||||
|
||||
Draw.shader(Shaders.build, false);
|
||||
Shaders.build.apply();
|
||||
Draw.rect(weaveRegion, tile.drawx(), tile.drawy()).rot(entity.time);
|
||||
Draw.rect(weaveRegion, tile.drawx(), tile.drawy(), entity.time);
|
||||
Draw.shader();
|
||||
|
||||
Draw.color(Palette.accent);
|
||||
|
||||
@@ -25,7 +25,7 @@ public class Pulverizer extends GenericCrafter{
|
||||
GenericCrafterEntity entity = tile.entity();
|
||||
|
||||
Draw.rect(region, tile.drawx(), tile.drawy());
|
||||
Draw.rect(rotatorRegion, tile.drawx(), tile.drawy()).rot(entity.totalProgress * 2f);
|
||||
Draw.rect(rotatorRegion, tile.drawx(), tile.drawy(), entity.totalProgress * 2f);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -51,7 +51,7 @@ public class SolidPump extends Pump{
|
||||
Draw.alpha(tile.entity.liquids.total() / liquidCapacity);
|
||||
Draw.rect(liquidRegion, tile.drawx(), tile.drawy());
|
||||
Draw.color();
|
||||
Draw.rect(name + "-rotator", tile.drawx(), tile.drawy()).rot(entity.pumpTime * rotateSpeed);
|
||||
Draw.rect(name + "-rotator", tile.drawx(), tile.drawy(), entity.pumpTime * rotateSpeed);
|
||||
Draw.rect(name + "-top", tile.drawx(), tile.drawy());
|
||||
}
|
||||
|
||||
|
||||
@@ -111,7 +111,7 @@ public class MechPad extends Block{
|
||||
Draw.color(Palette.accent);
|
||||
for(int i = 0; i < 4; i ++){
|
||||
float length = tilesize * size/2f + 3 + Mathf.absin(Time.time(), 5f, 2f);
|
||||
Draw.rect("transfer-arrow", tile.drawx() + Geometry.d4[i].x * length, tile.drawy() + Geometry.d4[i].y * length).rot((i+2) * 90);
|
||||
Draw.rect("transfer-arrow", tile.drawx() + Geometry.d4[i].x * length, tile.drawy() + Geometry.d4[i].y * length, (i+2) * 90);
|
||||
}
|
||||
Draw.color();
|
||||
}
|
||||
@@ -142,7 +142,7 @@ public class MechPad extends Block{
|
||||
public void draw(Tile tile){
|
||||
MechFactoryEntity entity = tile.entity();
|
||||
|
||||
Draw.rect(Core.atlas.find(name), tile.drawx(), tile.drawy()).rot(entity.open ? 180f : 0f);
|
||||
Draw.rect(Core.atlas.find(name), tile.drawx(), tile.drawy(), entity.open ? 180f : 0f);
|
||||
|
||||
if(entity.player != null){
|
||||
TextureRegion region = mech.iconRegion;
|
||||
|
||||
@@ -60,7 +60,7 @@ public class RepairPoint extends Block{
|
||||
public void drawLayer(Tile tile){
|
||||
RepairPointEntity entity = tile.entity();
|
||||
|
||||
Draw.rect(topRegion, tile.drawx(), tile.drawy()).rot(entity.rotation - 90);
|
||||
Draw.rect(topRegion, tile.drawx(), tile.drawy(), entity.rotation - 90);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user