diff --git a/.gitignore b/.gitignore index 611dd73e9a..455159c956 100644 --- a/.gitignore +++ b/.gitignore @@ -14,7 +14,7 @@ logs/ /core/lib/ /core/assets-raw/sprites/generated/ /annotations/build/ -/kryonet/build/ +/net/build/ /tools/build/ /tests/build/ /server/build/ diff --git a/android/build.gradle b/android/build.gradle index 4a388fee88..3f10a5a3e2 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -31,13 +31,12 @@ dependencies { implementation 'org.sufficientlysecure:donations:2.5' implementation 'com.google.android.gms:play-services-auth:16.0.1' - implementation "com.badlogicgames.gdx:gdx-backend-android:$gdxVersion" + implementation project(":Arc:backends:backend-android") natives "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-armeabi" natives "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-armeabi-v7a" natives "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-arm64-v8a" natives "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-x86" natives "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-x86_64" - implementation "com.badlogicgames.gdx:gdx-freetype:$gdxVersion" natives "com.badlogicgames.gdx:gdx-freetype-platform:$gdxVersion:natives-armeabi" natives "com.badlogicgames.gdx:gdx-freetype-platform:$gdxVersion:natives-armeabi-v7a" natives "com.badlogicgames.gdx:gdx-freetype-platform:$gdxVersion:natives-arm64-v8a" diff --git a/android/src/io/anuke/mindustry/AndroidLauncher.java b/android/src/io/anuke/mindustry/AndroidLauncher.java index 07fb4ce0c0..00f71dd74b 100644 --- a/android/src/io/anuke/mindustry/AndroidLauncher.java +++ b/android/src/io/anuke/mindustry/AndroidLauncher.java @@ -8,28 +8,28 @@ import android.content.pm.PackageManager; import android.net.Uri; import android.os.Build; import android.os.Bundle; -import android.provider.Core.settings.Secure; +import android.provider.Settings.Secure; import android.telephony.TelephonyManager; import android.util.Log; -import com.badlogic.gdx.Gdx; -import com.badlogic.gdx.backends.android.AndroidApplicationConfiguration; -import com.badlogic.gdx.files.FileHandle; -import com.badlogic.gdx.utils.Base64Coder; import com.google.android.gms.common.GoogleApiAvailability; import com.google.android.gms.common.GooglePlayServicesNotAvailableException; import com.google.android.gms.common.GooglePlayServicesRepairableException; import com.google.android.gms.security.ProviderInstaller; -import io.anuke.kryonet.KryoClient; -import io.anuke.kryonet.KryoServer; +import io.anuke.arc.Core; +import io.anuke.arc.backends.android.surfaceview.AndroidApplication; +import io.anuke.arc.backends.android.surfaceview.AndroidApplicationConfiguration; +import io.anuke.arc.files.FileHandle; +import io.anuke.arc.function.Consumer; +import io.anuke.arc.scene.ui.layout.Unit; +import io.anuke.arc.util.Strings; +import io.anuke.arc.util.serialization.Base64Coder; +import io.anuke.net.KryoClient; +import io.anuke.net.KryoServer; import io.anuke.mindustry.core.Platform; import io.anuke.mindustry.game.Saves.SaveSlot; import io.anuke.mindustry.io.SaveIO; import io.anuke.mindustry.net.Net; import io.anuke.mindustry.ui.dialogs.FileChooser; -import io.anuke.arc.function.Consumer; -import io.anuke.arc.scene.ui.layout.Unit; -import io.anuke.arc.util.Bundles; -import io.anuke.arc.util.Strings; import java.io.File; import java.io.FileInputStream; @@ -39,7 +39,7 @@ import java.util.ArrayList; import static io.anuke.mindustry.Vars.*; -public class AndroidLauncher extends PatchedAndroidApplication{ +public class AndroidLauncher extends AndroidApplication{ public static final int PERMISSION_REQUEST_CODE = 1; boolean doubleScaleTablets = true; FileChooser chooser; @@ -161,10 +161,10 @@ public class AndroidLauncher extends PatchedAndroidApplication{ InputStream inStream; if(myFile != null) inStream = new FileInputStream(myFile); else inStream = getContentResolver().openInputStream(uri); - Gdx.app.postRunnable(() -> { + Core.app.post(() -> { if(save){ //open save System.out.println("Opening save."); - FileHandle file = Gdx.files.local("temp-save." + saveExtension); + FileHandle file = Core.files.local("temp-save." + saveExtension); file.write(inStream, false); if(SaveIO.isSaveValid(file)){ try{ @@ -177,7 +177,7 @@ public class AndroidLauncher extends PatchedAndroidApplication{ ui.showError("$text.save.import.invalid"); } }else if(map){ //open map - Gdx.app.postRunnable(() -> { + Core.app.post(() -> { System.out.println("Opening map."); if(!ui.editor.isShown()){ ui.editor.show(); diff --git a/android/src/io/anuke/mindustry/PatchedAndroidApplication.java b/android/src/io/anuke/mindustry/PatchedAndroidApplication.java deleted file mode 100644 index 78bc0476e9..0000000000 --- a/android/src/io/anuke/mindustry/PatchedAndroidApplication.java +++ /dev/null @@ -1,20 +0,0 @@ -package io.anuke.mindustry; - -import com.badlogic.gdx.backends.android.AndroidApplication; -import java.util.concurrent.ExecutorService; -import java.util.concurrent.Executors; - -public abstract class PatchedAndroidApplication extends AndroidApplication { - private final ExecutorService exec = Executors.newSingleThreadExecutor(); - - @Override - protected void onPause () { - if(useImmersiveMode) { - exec.submit(() -> { - try {Thread.sleep(100);} catch (InterruptedException ignored) {} - graphics.onDrawFrame(null); - }); - } - super.onPause(); - } -} \ No newline at end of file diff --git a/build.gradle b/build.gradle index bedef4db0c..5edb8b2255 100644 --- a/build.gradle +++ b/build.gradle @@ -89,6 +89,7 @@ project(":desktop"){ dependencies{ compile project(":core") compile project(":net") + if(new File(projectDir.parent, '../debug').exists() && System.properties["release"] == null) compile project(":debug") compile "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-desktop" @@ -145,11 +146,12 @@ project(":ios"){ dependencies{ compile project(":core") - implementation project(":net") + compile project(":net") + compile project(":Arc:backends:backend-robovm") + compile "com.mobidevelop.robovm:robovm-rt:$roboVMVersion" compile "com.mobidevelop.robovm:robovm-cocoatouch:$roboVMVersion" - compile "com.badlogicgames.gdx:gdx-backend-robovm:$gdxVersion" compile "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-ios" compile "com.badlogicgames.gdx:gdx-freetype-platform:$gdxVersion:natives-ios" } @@ -185,11 +187,9 @@ project(":server"){ apply plugin: "java" dependencies{ - compile project(":core") compile project(":net") - compile "com.badlogicgames.gdx:gdx-backend-headless:$gdxVersion" - compile "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-desktop" + compile project(":Arc:backends:backend-headless") } } @@ -200,8 +200,7 @@ project(":tests"){ testImplementation project(":core") testImplementation('org.junit.jupiter:junit-jupiter-api:5.1.0') testRuntimeOnly('org.junit.jupiter:junit-jupiter-engine:5.1.0') - testImplementation "com.badlogicgames.gdx:gdx-backend-headless:$gdxVersion" - testImplementation "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-desktop" + compile project(":Arc:backends:backend-headless") } test{ diff --git a/core/src/io/anuke/mindustry/content/Mechs.java b/core/src/io/anuke/mindustry/content/Mechs.java index 82651d9ec6..fed2e528f5 100644 --- a/core/src/io/anuke/mindustry/content/Mechs.java +++ b/core/src/io/anuke/mindustry/content/Mechs.java @@ -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); diff --git a/core/src/io/anuke/mindustry/content/blocks/TurretBlocks.java b/core/src/io/anuke/mindustry/content/blocks/TurretBlocks.java index 2a11a2c96f..3bb6f8ba72 100644 --- a/core/src/io/anuke/mindustry/content/blocks/TurretBlocks.java +++ b/core/src/io/anuke/mindustry/content/blocks/TurretBlocks.java @@ -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); } }; diff --git a/core/src/io/anuke/mindustry/content/bullets/TurretBullets.java b/core/src/io/anuke/mindustry/content/bullets/TurretBullets.java index a326387785..1bce07f371 100644 --- a/core/src/io/anuke/mindustry/content/bullets/TurretBullets.java +++ b/core/src/io/anuke/mindustry/content/bullets/TurretBullets.java @@ -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(); } diff --git a/core/src/io/anuke/mindustry/content/fx/ShootFx.java b/core/src/io/anuke/mindustry/content/fx/ShootFx.java index 263ab8cf43..f2c588610a 100644 --- a/core/src/io/anuke/mindustry/content/fx/ShootFx.java +++ b/core/src/io/anuke/mindustry/content/fx/ShootFx.java @@ -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); diff --git a/core/src/io/anuke/mindustry/core/Control.java b/core/src/io/anuke/mindustry/core/Control.java index 56cdb7e2f9..054a2be00c 100644 --- a/core/src/io/anuke/mindustry/core/Control.java +++ b/core/src/io/anuke/mindustry/core/Control.java @@ -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(); diff --git a/core/src/io/anuke/mindustry/core/Renderer.java b/core/src/io/anuke/mindustry/core/Renderer.java index e5dc8abe04..65963616d7 100644 --- a/core/src/io/anuke/mindustry/core/Renderer.java +++ b/core/src/io/anuke/mindustry/core/Renderer.java @@ -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(); diff --git a/core/src/io/anuke/mindustry/core/UI.java b/core/src/io/anuke/mindustry/core/UI.java index 0b248f5fa1..7583eb01f9 100644 --- a/core/src/io/anuke/mindustry/core/UI.java +++ b/core/src/io/anuke/mindustry/core/UI.java @@ -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 diff --git a/core/src/io/anuke/mindustry/editor/MapRenderer.java b/core/src/io/anuke/mindustry/editor/MapRenderer.java index a0b08ad66a..1db1df1c96 100644 --- a/core/src/io/anuke/mindustry/editor/MapRenderer.java +++ b/core/src/io/anuke/mindustry/editor/MapRenderer.java @@ -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()); } diff --git a/core/src/io/anuke/mindustry/entities/Player.java b/core/src/io/anuke/mindustry/entities/Player.java index 9b79e4aff2..3878881b39 100644 --- a/core/src/io/anuke/mindustry/entities/Player.java +++ b/core/src/io/anuke/mindustry/entities/Player.java @@ -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(); diff --git a/core/src/io/anuke/mindustry/entities/Unit.java b/core/src/io/anuke/mindustry/entities/Unit.java index 88217b73b8..1c3d4c6660 100644 --- a/core/src/io/anuke/mindustry/entities/Unit.java +++ b/core/src/io/anuke/mindustry/entities/Unit.java @@ -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(){ diff --git a/core/src/io/anuke/mindustry/entities/bullet/ArtilleryBulletType.java b/core/src/io/anuke/mindustry/entities/bullet/ArtilleryBulletType.java index 7bbba4afeb..6a317f0882 100644 --- a/core/src/io/anuke/mindustry/entities/bullet/ArtilleryBulletType.java +++ b/core/src/io/anuke/mindustry/entities/bullet/ArtilleryBulletType.java @@ -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(); } } diff --git a/core/src/io/anuke/mindustry/entities/bullet/BasicBulletType.java b/core/src/io/anuke/mindustry/entities/bullet/BasicBulletType.java index 44e437f4de..7f3ca88aeb 100644 --- a/core/src/io/anuke/mindustry/entities/bullet/BasicBulletType.java +++ b/core/src/io/anuke/mindustry/entities/bullet/BasicBulletType.java @@ -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(); } diff --git a/core/src/io/anuke/mindustry/entities/effect/RubbleDecal.java b/core/src/io/anuke/mindustry/entities/effect/RubbleDecal.java index 6ea1f5ca9e..51dda93718 100644 --- a/core/src/io/anuke/mindustry/entities/effect/RubbleDecal.java +++ b/core/src/io/anuke/mindustry/entities/effect/RubbleDecal.java @@ -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); } } diff --git a/core/src/io/anuke/mindustry/entities/effect/ScorchDecal.java b/core/src/io/anuke/mindustry/entities/effect/ScorchDecal.java index 98ae43bc86..ced259f6e9 100644 --- a/core/src/io/anuke/mindustry/entities/effect/ScorchDecal.java +++ b/core/src/io/anuke/mindustry/entities/effect/ScorchDecal.java @@ -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); } } } diff --git a/core/src/io/anuke/mindustry/entities/units/BaseUnit.java b/core/src/io/anuke/mindustry/entities/units/BaseUnit.java index 5e6afa85ca..d73b42bccc 100644 --- a/core/src/io/anuke/mindustry/entities/units/BaseUnit.java +++ b/core/src/io/anuke/mindustry/entities/units/BaseUnit.java @@ -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); } } } diff --git a/core/src/io/anuke/mindustry/entities/units/FlyingUnit.java b/core/src/io/anuke/mindustry/entities/units/FlyingUnit.java index 2db599d42d..bc9e172d59 100644 --- a/core/src/io/anuke/mindustry/entities/units/FlyingUnit.java +++ b/core/src/io/anuke/mindustry/entities/units/FlyingUnit.java @@ -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(); diff --git a/core/src/io/anuke/mindustry/entities/units/GroundUnit.java b/core/src/io/anuke/mindustry/entities/units/GroundUnit.java index 122fec1238..d5d965215a 100644 --- a/core/src/io/anuke/mindustry/entities/units/GroundUnit.java +++ b/core/src/io/anuke/mindustry/entities/units/GroundUnit.java @@ -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(); diff --git a/core/src/io/anuke/mindustry/game/Saves.java b/core/src/io/anuke/mindustry/game/Saves.java index ba93efea35..d1c42703f4 100644 --- a/core/src/io/anuke/mindustry/game/Saves.java +++ b/core/src/io/anuke/mindustry/game/Saves.java @@ -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(); } diff --git a/core/src/io/anuke/mindustry/graphics/BlockRenderer.java b/core/src/io/anuke/mindustry/graphics/BlockRenderer.java index 49d256f535..a7ed0b65ae 100644 --- a/core/src/io/anuke/mindustry/graphics/BlockRenderer.java +++ b/core/src/io/anuke/mindustry/graphics/BlockRenderer.java @@ -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); diff --git a/core/src/io/anuke/mindustry/graphics/FloorRenderer.java b/core/src/io/anuke/mindustry/graphics/FloorRenderer.java index 6dcb73b6d5..2c50f11638 100644 --- a/core/src/io/anuke/mindustry/graphics/FloorRenderer.java +++ b/core/src/io/anuke/mindustry/graphics/FloorRenderer.java @@ -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(){ diff --git a/core/src/io/anuke/mindustry/graphics/MinimapRenderer.java b/core/src/io/anuke/mindustry/graphics/MinimapRenderer.java index 017a653340..95d386f8eb 100644 --- a/core/src/io/anuke/mindustry/graphics/MinimapRenderer.java +++ b/core/src/io/anuke/mindustry/graphics/MinimapRenderer.java @@ -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(); diff --git a/core/src/io/anuke/mindustry/graphics/Shapes.java b/core/src/io/anuke/mindustry/graphics/Shapes.java index bc460b89b2..0faf484d8f 100644 --- a/core/src/io/anuke/mindustry/graphics/Shapes.java +++ b/core/src/io/anuke/mindustry/graphics/Shapes.java @@ -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); } } diff --git a/core/src/io/anuke/mindustry/input/DesktopInput.java b/core/src/io/anuke/mindustry/input/DesktopInput.java index 39b02e6482..9402a8da40 100644 --- a/core/src/io/anuke/mindustry/input/DesktopInput.java +++ b/core/src/io/anuke/mindustry/input/DesktopInput.java @@ -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)); diff --git a/core/src/io/anuke/mindustry/input/MobileInput.java b/core/src/io/anuke/mindustry/input/MobileInput.java index c4e1450586..2dcaafd89f 100644 --- a/core/src/io/anuke/mindustry/input/MobileInput.java +++ b/core/src/io/anuke/mindustry/input/MobileInput.java @@ -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); diff --git a/core/src/io/anuke/mindustry/maps/missions/BlockLocMission.java b/core/src/io/anuke/mindustry/maps/missions/BlockLocMission.java index 929c9b07af..2929e86e4a 100644 --- a/core/src/io/anuke/mindustry/maps/missions/BlockLocMission.java +++ b/core/src/io/anuke/mindustry/maps/missions/BlockLocMission.java @@ -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(); } diff --git a/core/src/io/anuke/mindustry/ui/GridImage.java b/core/src/io/anuke/mindustry/ui/GridImage.java index f0e6704cb7..fd164cc191 100644 --- a/core/src/io/anuke/mindustry/ui/GridImage.java +++ b/core/src/io/anuke/mindustry/ui/GridImage.java @@ -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); } } diff --git a/core/src/io/anuke/mindustry/ui/Minimap.java b/core/src/io/anuke/mindustry/ui/Minimap.java index da07bdc36e..243e8039da 100644 --- a/core/src/io/anuke/mindustry/ui/Minimap.java +++ b/core/src/io/anuke/mindustry/ui/Minimap.java @@ -18,7 +18,7 @@ public class Minimap extends Container{ 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); diff --git a/core/src/io/anuke/mindustry/ui/dialogs/GenViewDialog.java b/core/src/io/anuke/mindustry/ui/dialogs/GenViewDialog.java index 1b59bfd1f0..484e8cad28 100644 --- a/core/src/io/anuke/mindustry/ui/dialogs/GenViewDialog.java +++ b/core/src/io/anuke/mindustry/ui/dialogs/GenViewDialog.java @@ -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); } } } diff --git a/core/src/io/anuke/mindustry/ui/dialogs/SectorsDialog.java b/core/src/io/anuke/mindustry/ui/dialogs/SectorsDialog.java index 36e378265c..32c7cfda8f 100644 --- a/core/src/io/anuke/mindustry/ui/dialogs/SectorsDialog.java +++ b/core/src/io/anuke/mindustry/ui/dialogs/SectorsDialog.java @@ -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); } } diff --git a/core/src/io/anuke/mindustry/ui/fragments/BackgroundFragment.java b/core/src/io/anuke/mindustry/ui/fragments/BackgroundFragment.java index 57c915f45b..2bd684e2f1 100644 --- a/core/src/io/anuke/mindustry/ui/fragments/BackgroundFragment.java +++ b/core/src/io/anuke/mindustry/ui/fragments/BackgroundFragment.java @@ -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(); } } diff --git a/core/src/io/anuke/mindustry/ui/fragments/ChatFragment.java b/core/src/io/anuke/mindustry/ui/fragments/ChatFragment.java index 478eb262fd..c3c31902ed 100644 --- a/core/src/io/anuke/mindustry/ui/fragments/ChatFragment.java +++ b/core/src/io/anuke/mindustry/ui/fragments/ChatFragment.java @@ -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(); diff --git a/core/src/io/anuke/mindustry/world/Block.java b/core/src/io/anuke/mindustry/world/Block.java index a0743fc413..dce5a18421 100644 --- a/core/src/io/anuke/mindustry/world/Block.java +++ b/core/src/io/anuke/mindustry/world/Block.java @@ -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){ diff --git a/core/src/io/anuke/mindustry/world/blocks/BuildBlock.java b/core/src/io/anuke/mindustry/world/blocks/BuildBlock.java index 5992a38ecd..65e84a528b 100644 --- a/core/src/io/anuke/mindustry/world/blocks/BuildBlock.java +++ b/core/src/io/anuke/mindustry/world/blocks/BuildBlock.java @@ -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(); } } diff --git a/core/src/io/anuke/mindustry/world/blocks/Floor.java b/core/src/io/anuke/mindustry/world/blocks/Floor.java index 9287c932bc..04ed73669a 100644 --- a/core/src/io/anuke/mindustry/world/blocks/Floor.java +++ b/core/src/io/anuke/mindustry/world/blocks/Floor.java @@ -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()); } } diff --git a/core/src/io/anuke/mindustry/world/blocks/LiquidBlock.java b/core/src/io/anuke/mindustry/world/blocks/LiquidBlock.java index 6aaff026af..939da4b122 100644 --- a/core/src/io/anuke/mindustry/world/blocks/LiquidBlock.java +++ b/core/src/io/anuke/mindustry/world/blocks/LiquidBlock.java @@ -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); } } diff --git a/core/src/io/anuke/mindustry/world/blocks/defense/DeflectorWall.java b/core/src/io/anuke/mindustry/world/blocks/defense/DeflectorWall.java index 544f0eee14..5a857f18e9 100644 --- a/core/src/io/anuke/mindustry/world/blocks/defense/DeflectorWall.java +++ b/core/src/io/anuke/mindustry/world/blocks/defense/DeflectorWall.java @@ -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); diff --git a/core/src/io/anuke/mindustry/world/blocks/defense/ForceProjector.java b/core/src/io/anuke/mindustry/world/blocks/defense/ForceProjector.java index 6b91b63fe0..b37ddd2386 100644 --- a/core/src/io/anuke/mindustry/world/blocks/defense/ForceProjector.java +++ b/core/src/io/anuke/mindustry/world/blocks/defense/ForceProjector.java @@ -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(); } diff --git a/core/src/io/anuke/mindustry/world/blocks/defense/MendProjector.java b/core/src/io/anuke/mindustry/world/blocks/defense/MendProjector.java index 55cc4b4437..ba90b43967 100644 --- a/core/src/io/anuke/mindustry/world/blocks/defense/MendProjector.java +++ b/core/src/io/anuke/mindustry/world/blocks/defense/MendProjector.java @@ -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); diff --git a/core/src/io/anuke/mindustry/world/blocks/defense/OverdriveProjector.java b/core/src/io/anuke/mindustry/world/blocks/defense/OverdriveProjector.java index 795fde22b8..8877c2a3d9 100644 --- a/core/src/io/anuke/mindustry/world/blocks/defense/OverdriveProjector.java +++ b/core/src/io/anuke/mindustry/world/blocks/defense/OverdriveProjector.java @@ -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); diff --git a/core/src/io/anuke/mindustry/world/blocks/defense/ShockMine.java b/core/src/io/anuke/mindustry/world/blocks/defense/ShockMine.java index 20963583ed..e8f0f2151f 100644 --- a/core/src/io/anuke/mindustry/world/blocks/defense/ShockMine.java +++ b/core/src/io/anuke/mindustry/world/blocks/defense/ShockMine.java @@ -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(); } diff --git a/core/src/io/anuke/mindustry/world/blocks/defense/turrets/Turret.java b/core/src/io/anuke/mindustry/world/blocks/defense/turrets/Turret.java index 64c01166fc..7177a189d3 100644 --- a/core/src/io/anuke/mindustry/world/blocks/defense/turrets/Turret.java +++ b/core/src/io/anuke/mindustry/world/blocks/defense/turrets/Turret.java @@ -75,10 +75,14 @@ public abstract class Turret extends Block{ protected TextureRegion baseTopRegion; protected BiConsumer 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 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 diff --git a/core/src/io/anuke/mindustry/world/blocks/distribution/Conduit.java b/core/src/io/anuke/mindustry/world/blocks/distribution/Conduit.java index 1b87ed086c..c8d3b26201 100644 --- a/core/src/io/anuke/mindustry/world/blocks/distribution/Conduit.java +++ b/core/src/io/anuke/mindustry/world/blocks/distribution/Conduit.java @@ -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 diff --git a/core/src/io/anuke/mindustry/world/blocks/distribution/Conveyor.java b/core/src/io/anuke/mindustry/world/blocks/distribution/Conveyor.java index ff07df56ad..73ed7c7f15 100644 --- a/core/src/io/anuke/mindustry/world/blocks/distribution/Conveyor.java +++ b/core/src/io/anuke/mindustry/world/blocks/distribution/Conveyor.java @@ -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 diff --git a/core/src/io/anuke/mindustry/world/blocks/distribution/ExtendingItemBridge.java b/core/src/io/anuke/mindustry/world/blocks/distribution/ExtendingItemBridge.java index de3ba37749..1df134830f 100644 --- a/core/src/io/anuke/mindustry/world/blocks/distribution/ExtendingItemBridge.java +++ b/core/src/io/anuke/mindustry/world/blocks/distribution/ExtendingItemBridge.java @@ -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(); } diff --git a/core/src/io/anuke/mindustry/world/blocks/distribution/ItemBridge.java b/core/src/io/anuke/mindustry/world/blocks/distribution/ItemBridge.java index 8321fb3b90..96b3c231c2 100644 --- a/core/src/io/anuke/mindustry/world/blocks/distribution/ItemBridge.java +++ b/core/src/io/anuke/mindustry/world/blocks/distribution/ItemBridge.java @@ -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(); } diff --git a/core/src/io/anuke/mindustry/world/blocks/distribution/MassDriver.java b/core/src/io/anuke/mindustry/world/blocks/distribution/MassDriver.java index e6ab3bbabc..831e3c53c2 100644 --- a/core/src/io/anuke/mindustry/world/blocks/distribution/MassDriver.java +++ b/core/src/io/anuke/mindustry/world/blocks/distribution/MassDriver.java @@ -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 diff --git a/core/src/io/anuke/mindustry/world/blocks/power/FusionReactor.java b/core/src/io/anuke/mindustry/world/blocks/power/FusionReactor.java index aca9989b55..efd00fbe74 100644 --- a/core/src/io/anuke/mindustry/world/blocks/power/FusionReactor.java +++ b/core/src/io/anuke/mindustry/world/blocks/power/FusionReactor.java @@ -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(); diff --git a/core/src/io/anuke/mindustry/world/blocks/production/Drill.java b/core/src/io/anuke/mindustry/world/blocks/production/Drill.java index 57ae52f95d..0f11ef6345 100644 --- a/core/src/io/anuke/mindustry/world/blocks/production/Drill.java +++ b/core/src/io/anuke/mindustry/world/blocks/production/Drill.java @@ -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()); diff --git a/core/src/io/anuke/mindustry/world/blocks/production/Fracker.java b/core/src/io/anuke/mindustry/world/blocks/production/Fracker.java index 514a4911a1..ebd4799505 100644 --- a/core/src/io/anuke/mindustry/world/blocks/production/Fracker.java +++ b/core/src/io/anuke/mindustry/world/blocks/production/Fracker.java @@ -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()); } diff --git a/core/src/io/anuke/mindustry/world/blocks/production/LiquidMixer.java b/core/src/io/anuke/mindustry/world/blocks/production/LiquidMixer.java index 6c485625bd..3351217fd1 100644 --- a/core/src/io/anuke/mindustry/world/blocks/production/LiquidMixer.java +++ b/core/src/io/anuke/mindustry/world/blocks/production/LiquidMixer.java @@ -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 diff --git a/core/src/io/anuke/mindustry/world/blocks/production/PhaseWeaver.java b/core/src/io/anuke/mindustry/world/blocks/production/PhaseWeaver.java index 8a21fa49ce..31eb976ff3 100644 --- a/core/src/io/anuke/mindustry/world/blocks/production/PhaseWeaver.java +++ b/core/src/io/anuke/mindustry/world/blocks/production/PhaseWeaver.java @@ -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); diff --git a/core/src/io/anuke/mindustry/world/blocks/production/Pulverizer.java b/core/src/io/anuke/mindustry/world/blocks/production/Pulverizer.java index 39ce78e424..8ec2e1409e 100644 --- a/core/src/io/anuke/mindustry/world/blocks/production/Pulverizer.java +++ b/core/src/io/anuke/mindustry/world/blocks/production/Pulverizer.java @@ -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 diff --git a/core/src/io/anuke/mindustry/world/blocks/production/SolidPump.java b/core/src/io/anuke/mindustry/world/blocks/production/SolidPump.java index aac9d6d8c9..57fc27a42f 100644 --- a/core/src/io/anuke/mindustry/world/blocks/production/SolidPump.java +++ b/core/src/io/anuke/mindustry/world/blocks/production/SolidPump.java @@ -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()); } diff --git a/core/src/io/anuke/mindustry/world/blocks/units/MechPad.java b/core/src/io/anuke/mindustry/world/blocks/units/MechPad.java index 5f47804ce5..75d48114ec 100644 --- a/core/src/io/anuke/mindustry/world/blocks/units/MechPad.java +++ b/core/src/io/anuke/mindustry/world/blocks/units/MechPad.java @@ -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; diff --git a/core/src/io/anuke/mindustry/world/blocks/units/RepairPoint.java b/core/src/io/anuke/mindustry/world/blocks/units/RepairPoint.java index cf93041a76..3a6a38cd61 100644 --- a/core/src/io/anuke/mindustry/world/blocks/units/RepairPoint.java +++ b/core/src/io/anuke/mindustry/world/blocks/units/RepairPoint.java @@ -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 diff --git a/desktop/src/io/anuke/mindustry/desktop/DesktopLauncher.java b/desktop/src/io/anuke/mindustry/desktop/DesktopLauncher.java index b93858e166..28179d163b 100644 --- a/desktop/src/io/anuke/mindustry/desktop/DesktopLauncher.java +++ b/desktop/src/io/anuke/mindustry/desktop/DesktopLauncher.java @@ -3,8 +3,8 @@ package io.anuke.mindustry.desktop; import io.anuke.arc.ApplicationListener; import io.anuke.arc.backends.lwjgl3.Lwjgl3Application; import io.anuke.arc.backends.lwjgl3.Lwjgl3ApplicationConfiguration; -import io.anuke.kryonet.KryoClient; -import io.anuke.kryonet.KryoServer; +import io.anuke.net.KryoClient; +import io.anuke.net.KryoServer; import io.anuke.mindustry.Mindustry; import io.anuke.mindustry.core.Platform; import io.anuke.mindustry.net.Net; diff --git a/ios/src/io/anuke/mindustry/IOSLauncher.java b/ios/src/io/anuke/mindustry/IOSLauncher.java index 8ed13f374b..b8bdb66dda 100644 --- a/ios/src/io/anuke/mindustry/IOSLauncher.java +++ b/ios/src/io/anuke/mindustry/IOSLauncher.java @@ -1,18 +1,17 @@ package io.anuke.mindustry; -import com.badlogic.gdx.Gdx; import com.badlogic.gdx.backends.iosrobovm.IOSApplication; import com.badlogic.gdx.backends.iosrobovm.IOSApplicationConfiguration; -import com.badlogic.gdx.files.FileHandle; -import io.anuke.kryonet.KryoClient; -import io.anuke.kryonet.KryoServer; +import io.anuke.arc.Core; +import io.anuke.arc.files.FileHandle; +import io.anuke.arc.scene.ui.layout.Unit; +import io.anuke.arc.util.Strings; +import io.anuke.net.KryoClient; +import io.anuke.net.KryoServer; import io.anuke.mindustry.core.Platform; import io.anuke.mindustry.game.Saves.SaveSlot; import io.anuke.mindustry.io.SaveIO; import io.anuke.mindustry.net.Net; -import io.anuke.arc.scene.ui.layout.Unit; -import io.anuke.arc.util.Bundles; -import io.anuke.arc.util.Strings; import org.robovm.apple.foundation.NSAutoreleasePool; import org.robovm.apple.foundation.NSURL; import org.robovm.apple.uikit.*; @@ -39,7 +38,7 @@ public class IOSLauncher extends IOSApplication.Delegate { @Override public void shareFile(FileHandle file){ - FileHandle to = Gdx.files.absolute(getDocumentsDirectory()).child(file.name()); + FileHandle to = Core.files.absolute(getDocumentsDirectory()).child(file.name()); file.copyTo(to); NSURL url = new NSURL(to.file()); @@ -91,9 +90,9 @@ public class IOSLauncher extends IOSApplication.Delegate { void openURL(NSURL url){ - Gdx.app.postRunnable(() -> { - FileHandle file = Gdx.files.absolute(getDocumentsDirectory()).child(url.getLastPathComponent()); - Gdx.files.absolute(url.getPath()).copyTo(file); + Core.app.post(() -> { + FileHandle file = Core.files.absolute(getDocumentsDirectory()).child(url.getLastPathComponent()); + Core.files.absolute(url.getPath()).copyTo(file); if(file.extension().equalsIgnoreCase(saveExtension)){ //open save @@ -109,7 +108,7 @@ public class IOSLauncher extends IOSApplication.Delegate { } }else if(file.extension().equalsIgnoreCase(mapExtension)){ //open map - Gdx.app.postRunnable(() -> { + Core.app.post(() -> { if (!ui.editor.isShown()) { ui.editor.show(); } diff --git a/net/build/libs/kryonet-release.jar b/net/build/libs/kryonet-release.jar deleted file mode 100644 index 43bf63903b..0000000000 Binary files a/net/build/libs/kryonet-release.jar and /dev/null differ diff --git a/net/build/libs/net-release.jar b/net/build/libs/net-release.jar index 6048c7e54f..dd50ccf98f 100644 Binary files a/net/build/libs/net-release.jar and b/net/build/libs/net-release.jar differ diff --git a/net/src/io/anuke/kryonet/ByteSerializer.java b/net/src/io/anuke/net/ByteSerializer.java similarity index 98% rename from net/src/io/anuke/kryonet/ByteSerializer.java rename to net/src/io/anuke/net/ByteSerializer.java index fac884bb83..a841d71994 100644 --- a/net/src/io/anuke/kryonet/ByteSerializer.java +++ b/net/src/io/anuke/net/ByteSerializer.java @@ -1,4 +1,4 @@ -package io.anuke.kryonet; +package io.anuke.net; import com.esotericsoftware.kryonet.FrameworkMessage; import com.esotericsoftware.kryonet.serialization.Serialization; diff --git a/net/src/io/anuke/kryonet/FrameworkSerializer.java b/net/src/io/anuke/net/FrameworkSerializer.java similarity index 98% rename from net/src/io/anuke/kryonet/FrameworkSerializer.java rename to net/src/io/anuke/net/FrameworkSerializer.java index 9b95ccdf98..6cc45e005e 100644 --- a/net/src/io/anuke/kryonet/FrameworkSerializer.java +++ b/net/src/io/anuke/net/FrameworkSerializer.java @@ -1,4 +1,4 @@ -package io.anuke.kryonet; +package io.anuke.net; import com.esotericsoftware.kryonet.FrameworkMessage; import com.esotericsoftware.kryonet.FrameworkMessage.*; diff --git a/net/src/io/anuke/kryonet/KryoClient.java b/net/src/io/anuke/net/KryoClient.java similarity index 99% rename from net/src/io/anuke/kryonet/KryoClient.java rename to net/src/io/anuke/net/KryoClient.java index 879a221419..d5d0ad8c67 100644 --- a/net/src/io/anuke/kryonet/KryoClient.java +++ b/net/src/io/anuke/net/KryoClient.java @@ -1,4 +1,4 @@ -package io.anuke.kryonet; +package io.anuke.net; import com.esotericsoftware.kryonet.*; import io.anuke.arc.Core; diff --git a/net/src/io/anuke/kryonet/KryoCore.java b/net/src/io/anuke/net/KryoCore.java similarity index 98% rename from net/src/io/anuke/kryonet/KryoCore.java rename to net/src/io/anuke/net/KryoCore.java index 9f4a100d4e..59792bf67f 100644 --- a/net/src/io/anuke/kryonet/KryoCore.java +++ b/net/src/io/anuke/net/KryoCore.java @@ -1,4 +1,4 @@ -package io.anuke.kryonet; +package io.anuke.net; import com.esotericsoftware.kryonet.util.Log; import com.esotericsoftware.kryonet.util.Log.Logger; diff --git a/net/src/io/anuke/kryonet/KryoServer.java b/net/src/io/anuke/net/KryoServer.java similarity index 99% rename from net/src/io/anuke/kryonet/KryoServer.java rename to net/src/io/anuke/net/KryoServer.java index 6920d5eb03..0f37c80e19 100644 --- a/net/src/io/anuke/kryonet/KryoServer.java +++ b/net/src/io/anuke/net/KryoServer.java @@ -1,4 +1,4 @@ -package io.anuke.kryonet; +package io.anuke.net; import com.dosse.upnp.UPnP; import com.esotericsoftware.kryonet.Connection; diff --git a/server/src/io/anuke/mindustry/server/CrashHandler.java b/server/src/io/anuke/mindustry/server/CrashHandler.java index f237f502aa..ce1311ca24 100644 --- a/server/src/io/anuke/mindustry/server/CrashHandler.java +++ b/server/src/io/anuke/mindustry/server/CrashHandler.java @@ -1,11 +1,11 @@ package io.anuke.mindustry.server; -import com.badlogic.gdx.utils.JsonValue; -import com.badlogic.gdx.utils.JsonValue.ValueType; -import com.badlogic.gdx.utils.JsonWriter.OutputType; import io.anuke.arc.Core; import io.anuke.arc.util.Log; import io.anuke.arc.util.OS; +import io.anuke.arc.util.serialization.JsonValue; +import io.anuke.arc.util.serialization.JsonValue.ValueType; +import io.anuke.arc.util.serialization.JsonWriter.OutputType; import io.anuke.mindustry.Vars; import io.anuke.mindustry.game.Version; import io.anuke.mindustry.net.Net; diff --git a/server/src/io/anuke/mindustry/server/ServerControl.java b/server/src/io/anuke/mindustry/server/ServerControl.java index 337ba5a97d..a20d2a54e3 100644 --- a/server/src/io/anuke/mindustry/server/ServerControl.java +++ b/server/src/io/anuke/mindustry/server/ServerControl.java @@ -1,22 +1,17 @@ package io.anuke.mindustry.server; -import com.badlogic.gdx.Gdx; -import com.badlogic.gdx.files.FileHandle; -import com.badlogic.gdx.utils.Array; -import com.badlogic.gdx.utils.ObjectSet; -import com.badlogic.gdx.utils.Timer; -import com.badlogic.gdx.utils.Timer.Task; import io.anuke.arc.ApplicationListener; import io.anuke.arc.Core; import io.anuke.arc.Events; +import io.anuke.arc.collection.Array; +import io.anuke.arc.collection.ObjectSet; import io.anuke.arc.entities.Effects; -import io.anuke.arc.util.CommandHandler; +import io.anuke.arc.files.FileHandle; +import io.anuke.arc.util.*; import io.anuke.arc.util.CommandHandler.Command; import io.anuke.arc.util.CommandHandler.Response; import io.anuke.arc.util.CommandHandler.ResponseType; -import io.anuke.arc.util.Log; -import io.anuke.arc.util.Strings; -import io.anuke.arc.util.Time; +import io.anuke.arc.util.Timer.Task; import io.anuke.mindustry.core.GameState.State; import io.anuke.mindustry.entities.Player; import io.anuke.mindustry.game.Difficulty; @@ -36,6 +31,7 @@ import io.anuke.mindustry.type.ItemType; import io.anuke.mindustry.world.Tile; import java.io.IOException; +import java.lang.StringBuilder; import java.time.LocalDateTime; import java.time.format.DateTimeFormatter; import java.util.Scanner; @@ -49,7 +45,7 @@ public class ServerControl implements ApplicationListener{ private static final int maxLogLength = 1024 * 512; private final CommandHandler handler = new CommandHandler(""); - private final FileHandle logFolder = Gdx.files.local("logs/"); + private final FileHandle logFolder = Core.files.local("logs/"); private FileHandle currentLogFile; private int gameOvers; @@ -99,13 +95,13 @@ public class ServerControl implements ApplicationListener{ } }); - Time.setDeltaProvider(() -> Gdx.graphics.getDeltaTime() * 60f); + Time.setDeltaProvider(() -> Core.graphics.getDeltaTime() * 60f); Effects.setScreenShakeProvider((a, b) -> {}); Effects.setEffectProvider((a, b, c, d, e, f) -> {}); registerCommands(); - Gdx.app.postRunnable(() -> { + Core.app.post(() -> { String[] commands = {}; if(args.length > 0){ @@ -176,7 +172,7 @@ public class ServerControl implements ApplicationListener{ }else{ Call.onInfoMessage("[SCARLET]Sector has been lost.[]\nRe-deploying in " + roundExtraTime + " seconds."); if(gameOvers >= 2){ - Core.settings.putInt("sector_y", Core.settings.getInt("sector_y") < 0 ? Core.settings.getInt("sector_y") + 1 : Core.settings.getInt("sector_y") - 1); + Core.settings.put("sector_y", Core.settings.getInt("sector_y") < 0 ? Core.settings.getInt("sector_y") + 1 : Core.settings.getInt("sector_y") - 1); Core.settings.save(); gameOvers = 0; } @@ -211,7 +207,7 @@ public class ServerControl implements ApplicationListener{ handler.register("exit", "Exit the server application.", arg -> { info("Shutting down server."); Net.dispose(); - Gdx.app.exit(); + Core.app.exit(); }); handler.register("stop", "Stop hosting the server.", arg -> { @@ -282,7 +278,7 @@ public class ServerControl implements ApplicationListener{ return; } info("&lyPort set to {0}.", port); - Core.settings.putInt("port", port); + Core.settings.put("port", port); Core.settings.save(); } }); @@ -308,7 +304,7 @@ public class ServerControl implements ApplicationListener{ } info(" &ly{0} FPS.", (int) (60f / Time.delta())); - info(" &ly{0} MB used.", Gdx.app.getJavaHeap() / 1024 / 1024); + info(" &ly{0} MB used.", Core.app.getJavaHeap() / 1024 / 1024); if(playerGroup.size() > 0){ info(" &lyPlayers: {0}", playerGroup.size()); @@ -343,8 +339,8 @@ public class ServerControl implements ApplicationListener{ handler.register("setsector", " ", "Sets the next sector to be played. Does not affect current game.", arg -> { try{ - Core.settings.putInt("sector_x", Integer.parseInt(arg[0])); - Core.settings.putInt("sector_y", Integer.parseInt(arg[1])); + Core.settings.put("sector_x", Integer.parseInt(arg[0])); + Core.settings.put("sector_y", Integer.parseInt(arg[1])); Core.settings.save(); info("Sector position set."); }catch(NumberFormatException e){ @@ -380,14 +376,14 @@ public class ServerControl implements ApplicationListener{ handler.register("crashreport", "", "Disables or enables automatic crash reporting", arg -> { boolean value = arg[0].equalsIgnoreCase("on"); - Core.settings.putBool("crashreport", value); + Core.settings.put("crashreport", value); Core.settings.save(); info("Crash reporting is now {0}.", value ? "on" : "off"); }); handler.register("logging", "", "Disables or enables server logs", arg -> { boolean value = arg[0].equalsIgnoreCase("on"); - Core.settings.putBool("logging", value); + Core.settings.put("logging", value); Core.settings.save(); info("Logging is now {0}.", value ? "on" : "off"); }); @@ -421,7 +417,7 @@ public class ServerControl implements ApplicationListener{ err("Invalid shuffle mode."); return; } - Core.settings.putBool("shuffle", arg[0].equals("on")); + Core.settings.put("shuffle", arg[0].equals("on")); Core.settings.save(); info("Shuffle mode set to '{0}'.", arg[0]); }); @@ -587,7 +583,7 @@ public class ServerControl implements ApplicationListener{ return; } - threads.run(() -> { + Core.app.post(() -> { SaveIO.loadFromSlot(slot); info("Save loaded."); host(); @@ -604,7 +600,7 @@ public class ServerControl implements ApplicationListener{ return; } - threads.run(() -> { + Core.app.post(() -> { int slot = Strings.parseInt(arg[0]); SaveIO.saveToSlot(slot); info("Saved to slot {0}.", slot); @@ -677,7 +673,7 @@ public class ServerControl implements ApplicationListener{ while(scan.hasNext()){ String line = scan.nextLine(); - Gdx.app.postRunnable(() -> { + Core.app.post(() -> { Response response = handler.handleMessage(line); if(response.type == ResponseType.unknownCommand){ diff --git a/server/src/io/anuke/mindustry/server/ServerLauncher.java b/server/src/io/anuke/mindustry/server/ServerLauncher.java index 8081a40059..aa760fa4f5 100644 --- a/server/src/io/anuke/mindustry/server/ServerLauncher.java +++ b/server/src/io/anuke/mindustry/server/ServerLauncher.java @@ -1,22 +1,18 @@ package io.anuke.mindustry.server; -import com.badlogic.gdx.ApplicationListener; -import com.badlogic.gdx.Gdx; -import com.badlogic.gdx.backends.headless.HeadlessApplication; -import com.badlogic.gdx.backends.headless.HeadlessApplicationConfiguration; + +import io.anuke.arc.ApplicationListener; import io.anuke.arc.Core; -import io.anuke.arc.util.EmptyLogger; -import io.anuke.kryonet.KryoClient; -import io.anuke.kryonet.KryoServer; +import io.anuke.arc.backends.headless.HeadlessApplication; +import io.anuke.arc.backends.headless.HeadlessApplicationConfiguration; +import io.anuke.net.KryoClient; +import io.anuke.net.KryoServer; import io.anuke.mindustry.net.Net; public class ServerLauncher extends HeadlessApplication{ public ServerLauncher(ApplicationListener listener, HeadlessApplicationConfiguration config){ super(listener, config); - - //don't do anything at all for GDX logging: don't want controller info and such - Gdx.app.setApplicationLogger(new EmptyLogger()); } public static void main(String[] args){ @@ -26,7 +22,7 @@ public class ServerLauncher extends HeadlessApplication{ Net.setServerProvider(new KryoServer()); HeadlessApplicationConfiguration config = new HeadlessApplicationConfiguration(); - Core.settings.setPrefHandler((appName) -> Gdx.files.local("config")); + Core.settings.setDataDirectory(Core.files.local("config")); new ServerLauncher(new MindustryServer(args), config); }catch(Throwable t){ diff --git a/settings.gradle b/settings.gradle index e29e15bc8a..cb3b08c8fe 100644 --- a/settings.gradle +++ b/settings.gradle @@ -27,6 +27,9 @@ if(System.properties["release"] == null || System.properties["release"] == "fals use(':Arc:extensions:freetype', '../Arc/extensions/freetype') use(':Arc:backends', '../Arc/backends') use(':Arc:backends:backend-lwjgl3', '../Arc/backends/backend-lwjgl3') + use(':Arc:backends:backend-android', '../Arc/backends/backend-android') + use(':Arc:backends:backend-robovm', '../Arc/backends/backend-robovm') + use(':Arc:backends:backend-headless', '../Arc/backends/backend-headless') } if (new File(settingsDir, '../debug').exists()) { use(':debug', '../debug') diff --git a/tests/src/test/java/ApplicationTests.java b/tests/src/test/java/ApplicationTests.java index 6824b8f4ff..04a868baab 100644 --- a/tests/src/test/java/ApplicationTests.java +++ b/tests/src/test/java/ApplicationTests.java @@ -1,7 +1,9 @@ -import com.badlogic.gdx.Gdx; -import com.badlogic.gdx.backends.headless.HeadlessApplication; -import com.badlogic.gdx.backends.headless.HeadlessApplicationConfiguration; -import com.badlogic.gdx.math.Point2; +import io.anuke.arc.ApplicationCore; +import io.anuke.arc.backends.headless.HeadlessApplication; +import io.anuke.arc.backends.headless.HeadlessApplicationConfiguration; +import io.anuke.arc.math.geom.Point2; +import io.anuke.arc.util.Log; +import io.anuke.arc.util.Time; import io.anuke.mindustry.Vars; import io.anuke.mindustry.content.Items; import io.anuke.mindustry.content.UnitTypes; @@ -24,16 +26,10 @@ import io.anuke.mindustry.type.Recipe; import io.anuke.mindustry.world.Block; import io.anuke.mindustry.world.Edges; import io.anuke.mindustry.world.Tile; -import io.anuke.arc.core.Timers; -import io.anuke.arc.modules.ModuleCore; -import io.anuke.arc.util.EmptyLogger; -import io.anuke.arc.util.Log; import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import java.io.File; - import static io.anuke.mindustry.Vars.*; import static org.junit.jupiter.api.Assertions.*; @@ -46,9 +42,9 @@ public class ApplicationTests{ Throwable[] exceptionThrown = {null}; Log.setUseColors(false); - ModuleCore core = new ModuleCore(){ + ApplicationCore core = new ApplicationCore(){ @Override - public void init(){ + public void setup(){ Vars.init(); headless = true; @@ -57,26 +53,21 @@ public class ApplicationTests{ content.load(); content.initialize(Content::init); - module(logic = new Logic()); - module(world = new World()); - module(netServer = new NetServer()); + add(logic = new Logic()); + add(world = new World()); + add(netServer = new NetServer()); } @Override - public void postInit(){ - super.postInit(); + public void init(){ + super.init(); begins[0] = true; } }; HeadlessApplicationConfiguration config = new HeadlessApplicationConfiguration(); - config.preferencesDirectory = "test_files/"; - new File("tests_files/").delete(); - - new HeadlessApplication(core, config){{ - Gdx.app.setApplicationLogger(new EmptyLogger()); - }}; + new HeadlessApplication(core, config); for(Thread thread : Thread.getAllStackTraces().keySet()){ if(thread.getName().equals("HeadlessApplication")){ diff --git a/tests/src/test/java/SectorTests.java b/tests/src/test/java/SectorTests.java index bb07bc2743..29c0d9a4a0 100644 --- a/tests/src/test/java/SectorTests.java +++ b/tests/src/test/java/SectorTests.java @@ -1,4 +1,4 @@ -import com.badlogic.gdx.utils.Array; +import io.anuke.arc.collection.Array; import io.anuke.mindustry.Vars; import io.anuke.mindustry.core.ContentLoader; import io.anuke.mindustry.maps.SectorPresets; @@ -8,7 +8,7 @@ import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.*; +import static org.junit.jupiter.api.Assertions.assertTrue; /** This class is responsible for testing predefined sectors. */ public class SectorTests{