mirror of
https://github.com/Anuken/Mindustry.git
synced 2025-01-26 23:50:18 +07:00
Improved pixel zoom / Possible player duplicate glitch
This commit is contained in:
parent
09a435320a
commit
a2b46eee6f
@ -213,6 +213,11 @@ public class NetClient implements ApplicationListener{
|
|||||||
SyncTrait entity = (SyncTrait) group.getByID(id);
|
SyncTrait entity = (SyncTrait) group.getByID(id);
|
||||||
boolean add = false;
|
boolean add = false;
|
||||||
|
|
||||||
|
if(entity == null && id == player.id){
|
||||||
|
entity = player;
|
||||||
|
add = true;
|
||||||
|
}
|
||||||
|
|
||||||
//entity must not be added yet, so create it
|
//entity must not be added yet, so create it
|
||||||
if(entity == null){
|
if(entity == null){
|
||||||
entity = (SyncTrait) TypeTrait.getTypeByID(typeID).get(); //create entity from supplier
|
entity = (SyncTrait) TypeTrait.getTypeByID(typeID).get(); //create entity from supplier
|
||||||
|
@ -4,7 +4,6 @@ import io.anuke.arc.Core;
|
|||||||
import io.anuke.arc.graphics.Blending;
|
import io.anuke.arc.graphics.Blending;
|
||||||
import io.anuke.arc.graphics.g2d.Draw;
|
import io.anuke.arc.graphics.g2d.Draw;
|
||||||
import io.anuke.arc.graphics.glutils.FrameBuffer;
|
import io.anuke.arc.graphics.glutils.FrameBuffer;
|
||||||
import io.anuke.arc.math.Mathf;
|
|
||||||
import io.anuke.arc.util.Disposable;
|
import io.anuke.arc.util.Disposable;
|
||||||
import io.anuke.mindustry.entities.type.Player;
|
import io.anuke.mindustry.entities.type.Player;
|
||||||
|
|
||||||
@ -15,21 +14,12 @@ import static io.anuke.mindustry.Vars.renderer;
|
|||||||
|
|
||||||
public class Pixelator implements Disposable{
|
public class Pixelator implements Disposable{
|
||||||
private FrameBuffer buffer = new FrameBuffer(2, 2);
|
private FrameBuffer buffer = new FrameBuffer(2, 2);
|
||||||
private float lastScale = -1;
|
|
||||||
|
|
||||||
public void drawPixelate(){
|
public void drawPixelate(){
|
||||||
|
float pre = renderer.getScale();
|
||||||
float scale = renderer.getScale();
|
float scale = renderer.getScale();
|
||||||
if(lastScale > 0){
|
scale = (int)scale;
|
||||||
//going smaller
|
renderer.setScale(scale);
|
||||||
if(scale < lastScale){
|
|
||||||
scale = (int)scale;
|
|
||||||
}else if(scale > lastScale){
|
|
||||||
scale = Mathf.ceil(scale);
|
|
||||||
|
|
||||||
}
|
|
||||||
renderer.setScale(scale);
|
|
||||||
}
|
|
||||||
lastScale = renderer.getScale();
|
|
||||||
camera.width = (int)camera.width;
|
camera.width = (int)camera.width;
|
||||||
camera.height = (int)camera.height;
|
camera.height = (int)camera.height;
|
||||||
|
|
||||||
@ -65,6 +55,7 @@ public class Pixelator implements Disposable{
|
|||||||
Core.camera.position.set(px, py);
|
Core.camera.position.set(px, py);
|
||||||
Core.settings.put("animatedwater", hadWater);
|
Core.settings.put("animatedwater", hadWater);
|
||||||
Core.settings.put("animatedshields", hadShields);
|
Core.settings.put("animatedshields", hadShields);
|
||||||
|
renderer.setScale(pre);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void rebind(){
|
public void rebind(){
|
||||||
|
Loading…
Reference in New Issue
Block a user