From 2c9921748cf2ad4b8eab68c0b8125d92d603b024 Mon Sep 17 00:00:00 2001 From: Anuken Date: Thu, 5 Oct 2017 16:47:06 -0400 Subject: [PATCH] Updated pixel rounding, turrets and resources no longer "wobble" --- .../io/anuke/mindustry/AndroidLauncher.java | 1 + build.gradle | 2 +- core/src/io/anuke/mindustry/Renderer.java | 20 ++++++++++++------- .../io/anuke/mindustry/entities/Player.java | 2 +- 4 files changed, 16 insertions(+), 9 deletions(-) diff --git a/android/src/io/anuke/mindustry/AndroidLauncher.java b/android/src/io/anuke/mindustry/AndroidLauncher.java index 24f61c1e50..89c3fffcdf 100644 --- a/android/src/io/anuke/mindustry/AndroidLauncher.java +++ b/android/src/io/anuke/mindustry/AndroidLauncher.java @@ -11,6 +11,7 @@ import android.os.Bundle; import io.anuke.mindustry.io.Formatter; public class AndroidLauncher extends AndroidApplication { + @SuppressLint("SimpleDateFormat") @Override protected void onCreate (Bundle savedInstanceState) { super.onCreate(savedInstanceState); diff --git a/build.gradle b/build.gradle index 31a3a1c792..487ede1dde 100644 --- a/build.gradle +++ b/build.gradle @@ -79,7 +79,7 @@ project(":core") { apply plugin: "java" dependencies { - compile 'com.github.anuken:ucore:7d37e1f5d0' + compile 'com.github.anuken:ucore:77506a62ac' compile "com.badlogicgames.gdx:gdx:$gdxVersion" compile "com.badlogicgames.gdx:gdx-ai:1.8.1" } diff --git a/core/src/io/anuke/mindustry/Renderer.java b/core/src/io/anuke/mindustry/Renderer.java index 6b33582d07..b330c78623 100644 --- a/core/src/io/anuke/mindustry/Renderer.java +++ b/core/src/io/anuke/mindustry/Renderer.java @@ -11,6 +11,7 @@ import com.badlogic.gdx.math.MathUtils; import com.badlogic.gdx.math.Vector2; import io.anuke.mindustry.GameState.State; +import io.anuke.mindustry.entities.Player; import io.anuke.mindustry.entities.TileEntity; import io.anuke.mindustry.input.AndroidInput; import io.anuke.mindustry.input.PlaceMode; @@ -70,6 +71,8 @@ public class Renderer extends RendererModule{ }else{ smoothCamera(World.core.worldx(), World.core.worldy(), 0.4f); } + + limitCamera(4f, player.x, player.y); float prex = camera.position.x, prey = camera.position.y; @@ -86,12 +89,10 @@ public class Renderer extends RendererModule{ float lastx = camera.position.x, lasty = camera.position.y; - if(android){ - camera.position.set((int) camera.position.x, (int) camera.position.y, 0); + camera.position.set((int) camera.position.x, (int) camera.position.y, 0); - if(Gdx.graphics.getHeight() / Core.cameraScale % 2 == 1){ - camera.position.add(0, -0.5f, 0); - } + if(Gdx.graphics.getHeight() / Core.cameraScale % 2 == 1){ + camera.position.add(0, -0.5f, 0); } drawDefault(); @@ -304,8 +305,13 @@ public class Renderer extends RendererModule{ for(Entity entity : Entities.all()){ if(entity instanceof DestructibleEntity && !(entity instanceof TileEntity)){ DestructibleEntity dest = ((DestructibleEntity) entity); - - drawHealth(dest.x, dest.y, dest.health, dest.maxhealth); + + if(dest instanceof Player){ + drawHealth((int)dest.x, (int)dest.y, dest.health, dest.maxhealth); + }else{ + drawHealth(dest.x, dest.y, dest.health, dest.maxhealth); + } + } } } diff --git a/core/src/io/anuke/mindustry/entities/Player.java b/core/src/io/anuke/mindustry/entities/Player.java index e7aa78788d..1f3df969ff 100644 --- a/core/src/io/anuke/mindustry/entities/Player.java +++ b/core/src/io/anuke/mindustry/entities/Player.java @@ -44,7 +44,7 @@ public class Player extends DestructibleEntity{ @Override public void draw(){ - Draw.rect("player", x, y, direction.angle()-90); + Draw.rect("player", (int)x, (int)y, direction.angle()-90); } @Override