Another minor optimization

This commit is contained in:
Anuken 2024-01-06 12:55:59 -05:00
parent fae167a91d
commit 981796a5b2
6 changed files with 9 additions and 8 deletions

View File

@ -46,7 +46,7 @@ public class Renderer implements ApplicationListener{
public @Nullable Bloom bloom;
public @Nullable FrameBuffer backgroundBuffer;
public FrameBuffer effectBuffer = new FrameBuffer();
public boolean animateShields, drawWeather = true, drawStatus, enableEffects, drawDisplays = true, drawLight = true;
public boolean animateShields, drawWeather = true, drawStatus, enableEffects, drawDisplays = true, drawLight = true, pixelate = false;
public float weatherAlpha;
/** minZoom = zooming out, maxZoom = zooming in */
public float minZoom = 1.5f, maxZoom = 6f;
@ -181,6 +181,7 @@ public class Renderer implements ApplicationListener{
enableEffects = settings.getBool("effects");
drawDisplays = !settings.getBool("hidedisplays");
drawLight = settings.getBool("drawlight", true);
pixelate = Core.settings.getBool("pixelate");
if(landTime > 0){
if(!state.isPaused()){
@ -227,7 +228,7 @@ public class Renderer implements ApplicationListener{
shakeIntensity = 0f;
}
if(pixelator.enabled()){
if(renderer.pixelate){
pixelator.drawPixelate();
}else{
draw();
@ -318,7 +319,7 @@ public class Renderer implements ApplicationListener{
Events.fire(Trigger.draw);
MapPreviewLoader.checkPreviews();
if(pixelator.enabled()){
if(renderer.pixelate){
pixelator.register();
}

View File

@ -223,7 +223,7 @@ public class Drawf{
/** Sets Draw.z to the text layer, and returns the previous layer. */
public static float text(){
float z = Draw.z();
if(renderer.pixelator.enabled()){
if(renderer.pixelate){
Draw.z(Layer.endPixeled);
}

View File

@ -58,7 +58,7 @@ public class Pixelator implements Disposable{
}
public boolean enabled(){
return Core.settings.getBool("pixelate");
return renderer.pixelate;
}
@Override

View File

@ -1361,7 +1361,7 @@ public class UnitType extends UnlockableContent implements Senseable{
unit.y + Angles.trnsy(unit.rotation + 180f, itemOffsetY),
size, size);
if(unit.isLocal() && !renderer.pixelator.enabled()){
if(unit.isLocal() && !renderer.pixelate){
Fonts.outline.draw(unit.stack.amount + "",
unit.x + Angles.trnsx(unit.rotation + 180f, itemOffsetY),
unit.y + Angles.trnsy(unit.rotation + 180f, itemOffsetY) - 3,

View File

@ -440,7 +440,7 @@ public class Block extends UnlockableContent implements Senseable{
}
public float drawPlaceText(String text, int x, int y, boolean valid){
if(renderer.pixelator.enabled()) return 0;
if(renderer.pixelate) return 0;
Color color = valid ? Pal.accent : Pal.remove;
Font font = Fonts.outline;

View File

@ -71,7 +71,7 @@ public class MessageBlock extends Block{
@Override
public void drawSelect(){
if(renderer.pixelator.enabled()) return;
if(renderer.pixelate) return;
Font font = Fonts.outline;
GlyphLayout l = Pools.obtain(GlyphLayout.class, GlyphLayout::new);