1
0
mirror of https://github.com/Anuken/Mindustry.git synced 2024-11-11 14:56:10 +03:00
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.animatedshields.name = Animated Shields
setting.antialias.name = Antialias[lightgray] (requires restart)[]
setting.playerindicators = Player Indicators
setting.playerindicators.name = Player Indicators
setting.indicators.name = Enemy Indicators
setting.autotarget.name = Auto-Target
setting.keyboard.name = Mouse+Keyboard Controls

View File

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

View File

@ -140,6 +140,7 @@ abstract class PlayerComp implements UnitController, Entityc, Syncc, Timerc, Dra
@Override
public void draw(){
Draw.z(Layer.playerName);
float z = Drawf.text();
BitmapFont font = Fonts.def;
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.setColor(Color.white);
font.setUseIntegerPositions(ints);
Draw.z(z);
}
void sendMessage(String text){

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(){

View File

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

View File

@ -48,6 +48,7 @@ public class ForceProjector extends Block{
canOverdrive = false;
hasLiquids = true;
hasItems = true;
expanded = true;
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
public void drawSelect(){
if(renderer.pixelator.enabled()) return;
BitmapFont font = Fonts.outline;
GlyphLayout l = Pools.obtain(GlyphLayout.class, GlyphLayout::new);
boolean ints = font.usesIntegerPositions();