This commit is contained in:
Anuken
2020-04-24 12:01:08 -04:00
parent 5d4ca753a7
commit 6041e238a6
10 changed files with 47 additions and 19 deletions

View File

@@ -17,6 +17,15 @@ import static mindustry.Vars.*;
public class Drawf{
public static float text(){
float z = Draw.z();
if(renderer.pixelator.enabled()){
Draw.z(Layer.endPixeled);
}
return z;
}
public static void light(float x, float y, float radius, Color color, float opacity){
renderer.lights.add(x, y, radius, color, opacity);
}

View File

@@ -66,7 +66,13 @@ public class Layer{
playerName = 150,
//space effects, currently only the land and launch effects
space = 160
space = 160,
//the end of all layers
end = 200,
//things after pixelation - used for text
endPixeled = 210
;
}

View File

@@ -96,12 +96,10 @@ public class MinimapRenderer implements Disposable{
Draw.rect(unit.type().region, x + rx, y + ry, scale, scale, unit.rotation() - 90);
Draw.reset();
if(withLabels && unit instanceof Playerc){
Playerc pl = (Playerc) unit;
if(!pl.isLocal()){
// Only display names for other players.
drawLabel(x + rx, y + ry, pl.name(), unit.team().color);
}
//only disable player names in multiplayer
if(withLabels && unit instanceof Playerc && net.active()){
Playerc pl = (Playerc)unit;
drawLabel(x + rx, y + ry, pl.name(), unit.team().color);
}
}

View File

@@ -12,13 +12,14 @@ import static mindustry.Vars.renderer;
public class Pixelator implements Disposable{
private FrameBuffer buffer = new FrameBuffer();
private float px, py, pre;
{
buffer.getTexture().setFilter(TextureFilter.Nearest, TextureFilter.Nearest);
}
public void drawPixelate(){
float pre = renderer.getScale();
pre = renderer.getScale();
float scale = renderer.getScale();
scale = (int)scale;
renderer.setScale(scale);
@@ -27,7 +28,8 @@ public class Pixelator implements Disposable{
graphics.clear(0f, 0f, 0f, 1f);
float px = Core.camera.position.x, py = Core.camera.position.y;
px = Core.camera.position.x;
py = Core.camera.position.y;
Core.camera.position.set((int)px + ((int)(camera.width) % 2 == 0 ? 0 : 0.5f), (int)py + ((int)(camera.height) % 2 == 0 ? 0 : 0.5f));
int w = (int)(Core.camera.width * renderer.landScale());
@@ -37,17 +39,19 @@ public class Pixelator implements Disposable{
buffer.begin();
renderer.draw();
buffer.end();
}
Draw.blend(Blending.disabled);
Draw.rect(buffer);
Draw.blend();
public void register(){
Draw.draw(Layer.end, () -> {
buffer.end();
//TODO set all of this up
//Groups.drawNames();
Draw.blend(Blending.disabled);
Draw.rect(buffer);
Draw.blend();
Core.camera.position.set(px, py);
renderer.setScale(pre);
Core.camera.position.set(px, py);
renderer.setScale(pre);
});
}
public boolean enabled(){