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

@@ -643,7 +643,7 @@ setting.buildautopause.name = Auto-Pause Building
setting.animatedwater.name = Animated Water setting.animatedwater.name = Animated Water
setting.animatedshields.name = Animated Shields setting.animatedshields.name = Animated Shields
setting.antialias.name = Antialias[lightgray] (requires restart)[] setting.antialias.name = Antialias[lightgray] (requires restart)[]
setting.playerindicators = Player Indicators setting.playerindicators.name = Player Indicators
setting.indicators.name = Enemy Indicators setting.indicators.name = Enemy Indicators
setting.autotarget.name = Auto-Target setting.autotarget.name = Auto-Target
setting.keyboard.name = Mouse+Keyboard Controls setting.keyboard.name = Mouse+Keyboard Controls

View File

@@ -194,6 +194,10 @@ public class Renderer implements ApplicationListener{
Draw.sort(true); Draw.sort(true);
if(pixelator.enabled()){
pixelator.register();
}
//TODO fx //TODO fx
Draw.draw(Layer.background, this::drawBackground); Draw.draw(Layer.background, this::drawBackground);
@@ -220,6 +224,7 @@ public class Renderer implements ApplicationListener{
Draw.draw(Layer.effect + 0.001f, bloom::render); Draw.draw(Layer.effect + 0.001f, bloom::render);
} }
Draw.z(Layer.plans);
Draw.draw(Layer.plans, overlays::drawBottom); Draw.draw(Layer.plans, overlays::drawBottom);
if(settings.getBool("animatedshields")){ if(settings.getBool("animatedshields")){
@@ -244,7 +249,6 @@ public class Renderer implements ApplicationListener{
Draw.reset(); Draw.reset();
Draw.flush(); Draw.flush();
Draw.sort(false); Draw.sort(false);
} }
private void drawBackground(){ private void drawBackground(){

View File

@@ -140,6 +140,7 @@ abstract class PlayerComp implements UnitController, Entityc, Syncc, Timerc, Dra
@Override @Override
public void draw(){ public void draw(){
Draw.z(Layer.playerName); Draw.z(Layer.playerName);
float z = Drawf.text();
BitmapFont font = Fonts.def; BitmapFont font = Fonts.def;
GlyphLayout layout = Pools.obtain(GlyphLayout.class, GlyphLayout::new); GlyphLayout layout = Pools.obtain(GlyphLayout.class, GlyphLayout::new);
@@ -185,6 +186,8 @@ abstract class PlayerComp implements UnitController, Entityc, Syncc, Timerc, Dra
font.getData().setScale(1f); font.getData().setScale(1f);
font.setColor(Color.white); font.setColor(Color.white);
font.setUseIntegerPositions(ints); font.setUseIntegerPositions(ints);
Draw.z(z);
} }
void sendMessage(String text){ void sendMessage(String text){

View File

@@ -17,6 +17,15 @@ import static mindustry.Vars.*;
public class Drawf{ 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){ public static void light(float x, float y, float radius, Color color, float opacity){
renderer.lights.add(x, y, radius, color, opacity); renderer.lights.add(x, y, radius, color, opacity);
} }

View File

@@ -66,7 +66,13 @@ public class Layer{
playerName = 150, playerName = 150,
//space effects, currently only the land and launch effects //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.rect(unit.type().region, x + rx, y + ry, scale, scale, unit.rotation() - 90);
Draw.reset(); Draw.reset();
if(withLabels && unit instanceof Playerc){ //only disable player names in multiplayer
Playerc pl = (Playerc) unit; if(withLabels && unit instanceof Playerc && net.active()){
if(!pl.isLocal()){ Playerc pl = (Playerc)unit;
// Only display names for other players. drawLabel(x + rx, y + ry, pl.name(), unit.team().color);
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{ public class Pixelator implements Disposable{
private FrameBuffer buffer = new FrameBuffer(); private FrameBuffer buffer = new FrameBuffer();
private float px, py, pre;
{ {
buffer.getTexture().setFilter(TextureFilter.Nearest, TextureFilter.Nearest); buffer.getTexture().setFilter(TextureFilter.Nearest, TextureFilter.Nearest);
} }
public void drawPixelate(){ public void drawPixelate(){
float pre = renderer.getScale(); pre = renderer.getScale();
float scale = renderer.getScale(); float scale = renderer.getScale();
scale = (int)scale; scale = (int)scale;
renderer.setScale(scale); renderer.setScale(scale);
@@ -27,7 +28,8 @@ public class Pixelator implements Disposable{
graphics.clear(0f, 0f, 0f, 1f); 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)); 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()); int w = (int)(Core.camera.width * renderer.landScale());
@@ -37,17 +39,19 @@ public class Pixelator implements Disposable{
buffer.begin(); buffer.begin();
renderer.draw(); renderer.draw();
buffer.end(); }
Draw.blend(Blending.disabled); public void register(){
Draw.rect(buffer); Draw.draw(Layer.end, () -> {
Draw.blend(); buffer.end();
//TODO set all of this up Draw.blend(Blending.disabled);
//Groups.drawNames(); Draw.rect(buffer);
Draw.blend();
Core.camera.position.set(px, py); Core.camera.position.set(px, py);
renderer.setScale(pre); renderer.setScale(pre);
});
} }
public boolean enabled(){ public boolean enabled(){

View File

@@ -230,6 +230,7 @@ public class Block extends UnlockableContent{
font.getData().setScale(1f); font.getData().setScale(1f);
Draw.reset(); Draw.reset();
Pools.free(layout); Pools.free(layout);
return width; return width;
} }

View File

@@ -48,6 +48,7 @@ public class ForceProjector extends Block{
canOverdrive = false; canOverdrive = false;
hasLiquids = true; hasLiquids = true;
hasItems = true; hasItems = true;
expanded = true;
consumes.add(new ConsumeLiquidFilter(liquid -> liquid.temperature <= 0.5f && liquid.flammability < 0.1f, 0.1f)).boost().update(false); consumes.add(new ConsumeLiquidFilter(liquid -> liquid.temperature <= 0.5f && liquid.flammability < 0.1f, 0.1f)).boost().update(false);
} }

View File

@@ -62,6 +62,8 @@ public class MessageBlock extends Block{
@Override @Override
public void drawSelect(){ public void drawSelect(){
if(renderer.pixelator.enabled()) return;
BitmapFont font = Fonts.outline; BitmapFont font = Fonts.outline;
GlyphLayout l = Pools.obtain(GlyphLayout.class, GlyphLayout::new); GlyphLayout l = Pools.obtain(GlyphLayout.class, GlyphLayout::new);
boolean ints = font.usesIntegerPositions(); boolean ints = font.usesIntegerPositions();