Bugfixes
This commit is contained in:
@@ -641,6 +641,8 @@ public class Blocks implements ContentList{
|
||||
int liquidRegion = reg("-liquid");
|
||||
int topRegion =reg("-top");
|
||||
|
||||
drawIcons = () -> new TextureRegion[]{Core.atlas.find(name), Core.atlas.find(name + "-top")};
|
||||
|
||||
drawer = tile -> {
|
||||
GenericCrafterEntity entity = tile.entity();
|
||||
|
||||
@@ -666,6 +668,8 @@ public class Blocks implements ContentList{
|
||||
|
||||
int rotatorRegion = reg("-rotator");
|
||||
|
||||
drawIcons = () -> new TextureRegion[]{Core.atlas.find(name), Core.atlas.find(name + "-rotator")};
|
||||
|
||||
drawer = tile -> {
|
||||
GenericCrafterEntity entity = tile.entity();
|
||||
|
||||
|
||||
@@ -294,10 +294,12 @@ public class NetServer implements ApplicationListener{
|
||||
player.isShooting = shooting;
|
||||
player.getPlaceQueue().clear();
|
||||
for(BuildRequest req : requests){
|
||||
Tile tile = world.tile(req.x, req.y);
|
||||
if(tile == null) continue;
|
||||
//auto-skip done requests
|
||||
if(req.breaking && world.tile(req.x, req.y).block() == Blocks.air){
|
||||
if(req.breaking && tile.block() == Blocks.air){
|
||||
continue;
|
||||
}else if(!req.breaking && world.tile(req.x, req.y).block() == req.block && (!req.block.rotate || world.tile(req.x, req.y).getRotation() == req.rotation)){
|
||||
}else if(!req.breaking && tile.block() == req.block && (!req.block.rotate || tile.getRotation() == req.rotation)){
|
||||
continue;
|
||||
}
|
||||
player.getPlaceQueue().addLast(req);
|
||||
|
||||
@@ -47,6 +47,7 @@ public class Renderer implements ApplicationListener{
|
||||
public final BlockRenderer blocks = new BlockRenderer();
|
||||
public final MinimapRenderer minimap = new MinimapRenderer();
|
||||
public final OverlayRenderer overlays = new OverlayRenderer();
|
||||
public final Pixelator pixelator = new Pixelator();
|
||||
|
||||
public FrameBuffer shieldBuffer = new FrameBuffer(2, 2);
|
||||
private Color clearColor;
|
||||
@@ -132,8 +133,11 @@ public class Renderer implements ApplicationListener{
|
||||
}
|
||||
|
||||
updateShake(0.75f);
|
||||
|
||||
draw();
|
||||
if(pixelator.enabled()){
|
||||
pixelator.drawPixelate();
|
||||
}else{
|
||||
draw();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -139,6 +139,7 @@ public class BlockRenderer{
|
||||
shadowEvents.clear();
|
||||
|
||||
Draw.proj(camera.projection());
|
||||
renderer.pixelator.rebind();
|
||||
}
|
||||
|
||||
float ww = world.width() * tilesize, wh = world.height() * tilesize;
|
||||
|
||||
@@ -43,7 +43,7 @@ public enum CacheLayer{
|
||||
}
|
||||
|
||||
void beginShader(){
|
||||
if(!Core.settings.getBool("animatedwater")) return;
|
||||
if(!Core.settings.getBool("animatedwater") || renderer.pixelator.enabled()) return;
|
||||
|
||||
renderer.blocks.floor.endc();
|
||||
renderer.shieldBuffer.begin();
|
||||
@@ -52,7 +52,7 @@ public enum CacheLayer{
|
||||
}
|
||||
|
||||
void endShader(Shader shader){
|
||||
if(!Core.settings.getBool("animatedwater")) return;
|
||||
if(!Core.settings.getBool("animatedwater") || renderer.pixelator.enabled()) return;
|
||||
|
||||
renderer.blocks.floor.endc();
|
||||
renderer.shieldBuffer.end();
|
||||
|
||||
48
core/src/io/anuke/mindustry/graphics/Pixelator.java
Normal file
48
core/src/io/anuke/mindustry/graphics/Pixelator.java
Normal file
@@ -0,0 +1,48 @@
|
||||
package io.anuke.mindustry.graphics;
|
||||
|
||||
import io.anuke.arc.Core;
|
||||
import io.anuke.arc.graphics.g2d.Draw;
|
||||
import io.anuke.arc.graphics.glutils.FrameBuffer;
|
||||
import io.anuke.arc.util.Disposable;
|
||||
|
||||
import static io.anuke.mindustry.Vars.*;
|
||||
|
||||
public class Pixelator implements Disposable{
|
||||
private FrameBuffer buffer = new FrameBuffer(2, 2);
|
||||
|
||||
public void drawPixelate(){
|
||||
float px = Core.camera.position.x, py = Core.camera.position.y;
|
||||
Core.camera.position.set((int)px, (int)py + (Core.graphics.getHeight() % 2 == 0 ? 0 : 0.5f));
|
||||
|
||||
int w = (int)(Core.camera.width);
|
||||
int h = (int)(Core.camera.height);
|
||||
|
||||
if(buffer.getWidth() != w || buffer.getHeight() != h){
|
||||
buffer.resize(w, h);
|
||||
}
|
||||
|
||||
Draw.flush();
|
||||
buffer.begin();
|
||||
renderer.draw();
|
||||
Draw.flush();
|
||||
buffer.end();
|
||||
Draw.rect(Draw.wrap(buffer.getTexture()), Core.camera.position.x, Core.camera.position.y, Core.camera.width, -Core.camera.height);
|
||||
|
||||
Core.camera.position.set(px, py);
|
||||
}
|
||||
|
||||
public void rebind(){
|
||||
if(enabled()){
|
||||
buffer.begin();
|
||||
}
|
||||
}
|
||||
|
||||
public boolean enabled(){
|
||||
return Core.settings.getBool("pixelate");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void dispose(){
|
||||
buffer.dispose();
|
||||
}
|
||||
}
|
||||
@@ -214,6 +214,7 @@ public class SettingsMenuDialog extends SettingsDialog{
|
||||
graphics.checkPref("indicators", true);
|
||||
graphics.checkPref("animatedwater", false);
|
||||
graphics.checkPref("lasers", true);
|
||||
graphics.checkPref("pixelate", false);
|
||||
}
|
||||
|
||||
private void back(){
|
||||
|
||||
@@ -166,9 +166,10 @@ public class HudFragment extends Fragment{
|
||||
IntFormat fps = new IntFormat("fps");
|
||||
IntFormat ping = new IntFormat("ping");
|
||||
|
||||
info.label(() -> ping.get(Net.getPing())).visible(Net::client).right();
|
||||
|
||||
info.label(() -> ping.get(Net.getPing())).visible(Net::client).left();
|
||||
info.row();
|
||||
info.label(() -> fps.get(Core.graphics.getFramesPerSecond())).right();
|
||||
info.label(() -> fps.get(Core.graphics.getFramesPerSecond())).left();
|
||||
});
|
||||
|
||||
//spawner warning
|
||||
|
||||
Reference in New Issue
Block a user