Updated pixel rounding, turrets and resources no longer "wobble"

This commit is contained in:
Anuken
2017-10-05 16:47:06 -04:00
parent af29eb8c96
commit 2c9921748c
4 changed files with 16 additions and 9 deletions

View File

@ -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);

View File

@ -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"
}

View File

@ -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);
}
}
}
}

View File

@ -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