diff --git a/core/src/io/anuke/mindustry/Control.java b/core/src/io/anuke/mindustry/Control.java index f087a8d7fc..5308fd2e67 100644 --- a/core/src/io/anuke/mindustry/Control.java +++ b/core/src/io/anuke/mindustry/Control.java @@ -19,9 +19,10 @@ public class Control extends RendererModule{ //GifRecorder recoder = new GifRecorder(batch); public Control(){ - cameraScale = 4f; - setPixelation(); - buffers.add("shadow", (int) (Gdx.graphics.getWidth() / cameraScale), (int) (Gdx.graphics.getHeight() / cameraScale)); + cameraScale = 4; + pixelate(); + + Draw.addSurface("shadow", cameraScale); atlas = new Atlas("mindustry.atlas"); @@ -146,10 +147,7 @@ public class Control extends RendererModule{ @Override public void resize(int width, int height){ super.resize(width, height); - - buffers.remove("shadow"); - buffers.add("shadow", (int) (Gdx.graphics.getWidth() / cameraScale), (int) (Gdx.graphics.getHeight() / cameraScale)); - + rangex = (int) (width / tilesize / cameraScale/2)+2; rangey = (int) (height / tilesize / cameraScale/2)+2; } diff --git a/core/src/io/anuke/mindustry/Renderer.java b/core/src/io/anuke/mindustry/Renderer.java index 331dbcc36c..f996a98fc5 100644 --- a/core/src/io/anuke/mindustry/Renderer.java +++ b/core/src/io/anuke/mindustry/Renderer.java @@ -2,12 +2,9 @@ package io.anuke.mindustry; import static io.anuke.mindustry.Vars.*; -import com.badlogic.gdx.Gdx; import com.badlogic.gdx.Input.Buttons; import com.badlogic.gdx.graphics.Color; -import com.badlogic.gdx.graphics.GL20; import com.badlogic.gdx.graphics.OrthographicCamera; -import com.badlogic.gdx.graphics.g2d.Batch; import com.badlogic.gdx.math.MathUtils; import io.anuke.mindustry.entities.TileEntity; @@ -20,7 +17,6 @@ import io.anuke.ucore.core.Inputs; import io.anuke.ucore.entities.DestructibleEntity; import io.anuke.ucore.entities.Entities; import io.anuke.ucore.entities.Entity; -import io.anuke.ucore.graphics.FrameBufferMap; import io.anuke.ucore.scene.utils.Cursors; import io.anuke.ucore.util.Mathf; import io.anuke.ucore.util.Timers; @@ -29,21 +25,12 @@ public class Renderer{ public static void renderTiles(){ Draw.clear(); - Batch batch = control.batch; - FrameBufferMap buffers = control.buffers; OrthographicCamera camera = control.camera; int rangex = control.rangex, rangey = control.rangey; for(int l = 0; l < 4; l++){ if(l == 1){ - batch.end(); - buffers.end("pixel"); - - buffers.begin("shadow"); - - batch.begin(); - Gdx.gl.glClearColor(0, 0, 0, 0); - Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT); + Draw.surface("shadow"); } for(int x = -rangex; x <= rangex; x++){ @@ -66,17 +53,9 @@ public class Renderer{ } if(l == 1){ - batch.end(); - buffers.end("shadow"); - batch.setColor(0, 0, 0, 0.15f); - - buffers.begin("pixel"); - - control.drawFull("shadow"); - batch.setColor(Color.WHITE); - batch.setProjectionMatrix(camera.combined); - - batch.begin(); + Draw.color(0, 0, 0, 0.15f); + Draw.flushSurface(); + Draw.color(); } } } diff --git a/core/src/io/anuke/mindustry/UI.java b/core/src/io/anuke/mindustry/UI.java index 7afc88e1df..414d553924 100644 --- a/core/src/io/anuke/mindustry/UI.java +++ b/core/src/io/anuke/mindustry/UI.java @@ -54,8 +54,8 @@ public class UI extends SceneModule{ Batch batch = scene.getBatch(); Draw.color(); - int w = gwidth(); - int h = gheight(); + int w = (int)screen.x; + int h = (int)screen.y; Draw.color(Hue.lightness(0.6f)); @@ -331,15 +331,15 @@ public class UI extends SceneModule{ aleft(); abottom(); new button("+", ()->{ - if(control.cameraScale < 4f){ - control.cameraScale = 4f; + if(control.cameraScale < 4){ + control.cameraScale = 4; control.resize(Gdx.graphics.getWidth(), Gdx.graphics.getHeight()); } }).size(40); new button("-", ()->{ - if(control.cameraScale > 3f){ - control.cameraScale = 3f; + if(control.cameraScale > 3){ + control.cameraScale = 3; control.resize(Gdx.graphics.getWidth(), Gdx.graphics.getHeight()); } }).size(40); diff --git a/core/src/io/anuke/mindustry/Vars.java b/core/src/io/anuke/mindustry/Vars.java index 06866180e9..5e389e64ce 100644 --- a/core/src/io/anuke/mindustry/Vars.java +++ b/core/src/io/anuke/mindustry/Vars.java @@ -19,7 +19,7 @@ public class Vars{ public static final float wavespace = 20*60; public static final float enemyspawnspace = 65; public static final float breakduration = 30; - public static boolean debug = true; + public static boolean debug = false; public static final Vector2 vector = new Vector2(); diff --git a/core/src/io/anuke/mindustry/entities/Player.java b/core/src/io/anuke/mindustry/entities/Player.java index 02a54fb0c8..cabdf8234d 100644 --- a/core/src/io/anuke/mindustry/entities/Player.java +++ b/core/src/io/anuke/mindustry/entities/Player.java @@ -34,10 +34,6 @@ public class Player extends DestructibleEntity{ respawntime = respawnduration; } - @Override - public void removed(){ - } - @Override public void draw(){ Draw.rect("player", x, y, direction.angle()-90);