Misc polish stuff

This commit is contained in:
Anuken
2022-04-17 17:12:01 -04:00
parent 95c34996af
commit b5b4edcb67
7 changed files with 84 additions and 45 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;
public boolean animateShields, drawWeather = true, drawStatus, enableEffects, drawDisplays = true;
public float weatherAlpha;
/** minZoom = zooming out, maxZoom = zooming in */
public float minZoom = 1.5f, maxZoom = 6f;
@@ -171,6 +171,7 @@ public class Renderer implements ApplicationListener{
animateShields = settings.getBool("animatedshields");
drawStatus = Core.settings.getBool("blockstatus");
enableEffects = settings.getBool("effects");
drawDisplays = !settings.getBool("hidedisplays");
if(landTime > 0){
if(!state.isPaused()){

View File

@@ -338,55 +338,60 @@ public class WaveInfoDialog extends BaseDialog{
setColor(Color.white);
}}).width(300f).height(44f);
}).row();
}
t.table(a -> {
a.add("spawn: ");
t.table(a -> {
a.add("@waves.spawn").padRight(8);
a.button("", () -> {
if(!checkedSpawns){
//recalculate waves when changed
Vars.spawner.reset();
checkedSpawns = true;
a.button("", () -> {
if(!checkedSpawns){
//recalculate waves when changed
Vars.spawner.reset();
checkedSpawns = true;
}
BaseDialog dialog = new BaseDialog("@waves.spawn.select");
dialog.cont.pane(p -> {
p.background(Tex.button).margin(10f);
int i = 0;
int cols = 4;
int max = 20;
if(spawner.getSpawns().size >= max){
p.add("[lightgray](first " + max + ")").colspan(cols).padBottom(4).row();
}
BaseDialog dialog = new BaseDialog("Spawn Select");
dialog.cont.pane(p -> {
p.background(Tex.button).margin(10f);
int i = 0;
int cols = 4;
int max = 20;
for(var spawn : spawner.getSpawns()){
p.button(spawn.x + ", " + spawn.y, Styles.clearTogglet, () -> {
group.spawn = Point2.pack(spawn.x, spawn.y);
dialog.hide();
}).size(110f, 45f).checked(spawn.pos() == group.spawn);
if(spawner.getSpawns().size >= max){
p.add("[lightgray](first " + max + ")").colspan(cols).padBottom(4).row();
if(++i % cols == 0){
p.row();
}
for(var spawn : spawner.getSpawns()){
p.button(spawn.x + ", " + spawn.y, Styles.clearTogglet, () -> {
group.spawn = Point2.pack(spawn.x, spawn.y);
dialog.hide();
}).size(110f, 45f).checked(spawn.pos() == group.spawn);
if(++i % cols == 0){
p.row();
}
//only display first 20 spawns, you don't need to see more.
if(i >= 20){
break;
}
//only display first 20 spawns, you don't need to see more.
if(i >= 20){
break;
}
}
if(spawner.getSpawns().isEmpty()){
p.add("[scarlet]no spawns found in map");
}
});
dialog.setFillParent(false);
dialog.addCloseButton();
dialog.show();
}).width(160f).height(36f).get().getLabel().setText(() -> group.spawn == -1 ? "<all>" : Point2.x(group.spawn) + ", " + Point2.y(group.spawn));
p.button("@waves.spawn.all", Styles.clearTogglet, () -> {
group.spawn = -1;
dialog.hide();
}).size(110f, 45f).checked(-1 == group.spawn);
}).padBottom(8f).row();
}
if(spawner.getSpawns().isEmpty()){
p.add("@waves.spawn.none");
}
});
dialog.setFillParent(false);
dialog.addCloseButton();
dialog.show();
}).width(160f).height(36f).get().getLabel().setText(() -> group.spawn == -1 ? "@waves.spawn.all" : Point2.x(group.spawn) + ", " + Point2.y(group.spawn));
}).padBottom(8f).row();
}
}).width(340f).pad(8);

View File

@@ -450,6 +450,7 @@ public class SettingsMenuDialog extends BaseDialog{
}
graphics.checkPref("skipcoreanimation", false);
graphics.checkPref("hidedisplays", false);
if(!mobile){
Core.settings.put("swapdiagonal", false);

View File

@@ -6,6 +6,7 @@ import arc.graphics.g2d.*;
import arc.graphics.gl.*;
import arc.struct.*;
import arc.util.*;
import mindustry.*;
import mindustry.annotations.Annotations.*;
import mindustry.gen.*;
import mindustry.graphics.*;
@@ -59,6 +60,9 @@ public class LogicDisplay extends Block{
public void draw(){
super.draw();
//don't even bother processing anything when displays are off.
if(!Vars.renderer.drawDisplays) return;
Draw.draw(Draw.z(), () -> {
if(buffer == null){
buffer = new FrameBuffer(displaySize, displaySize);
@@ -68,6 +72,7 @@ public class LogicDisplay extends Block{
}
});
//don't bother processing commands if displays are off
if(!commands.isEmpty()){
Draw.draw(Draw.z(), () -> {
Tmp.m1.set(Draw.proj());