Optimizations
This commit is contained in:
@@ -253,7 +253,7 @@ public class Renderer extends RendererModule{
|
||||
}
|
||||
|
||||
private void drawFlyerShadows(){
|
||||
Graphics.surface(effectSurface);
|
||||
Graphics.surface(effectSurface, true, false);
|
||||
|
||||
float trnsX = 12, trnsY = -13;
|
||||
|
||||
@@ -263,12 +263,12 @@ public class Renderer extends RendererModule{
|
||||
|
||||
for(EntityGroup<? extends BaseUnit> group : unitGroups){
|
||||
if(!group.isEmpty()){
|
||||
drawAndInterpolate(group, Unit::isFlying, Unit::drawShadow);
|
||||
drawAndInterpolate(group, unit -> unit.isFlying() && !unit.isDead(), Unit::drawShadow);
|
||||
}
|
||||
}
|
||||
|
||||
if(!playerGroup.isEmpty()){
|
||||
drawAndInterpolate(playerGroup, Unit::isFlying, Unit::drawShadow);
|
||||
drawAndInterpolate(playerGroup, unit -> unit.isFlying() && !unit.isDead(), Unit::drawShadow);
|
||||
}
|
||||
|
||||
Graphics.end();
|
||||
|
||||
@@ -4,10 +4,6 @@ import com.badlogic.gdx.Gdx;
|
||||
import com.badlogic.gdx.utils.Array;
|
||||
import com.badlogic.gdx.utils.TimeUtils;
|
||||
import io.anuke.ucore.core.Timers;
|
||||
import io.anuke.ucore.entities.Entities;
|
||||
import io.anuke.ucore.entities.EntityGroup;
|
||||
import io.anuke.ucore.entities.EntityGroup.ArrayContainer;
|
||||
import io.anuke.ucore.entities.trait.Entity;
|
||||
import io.anuke.ucore.util.Log;
|
||||
|
||||
import static io.anuke.mindustry.Vars.control;
|
||||
@@ -89,9 +85,6 @@ public class ThreadHandler {
|
||||
public void setEnabled(boolean enabled){
|
||||
if(enabled){
|
||||
logic.doUpdate = false;
|
||||
for(EntityGroup<?> group : Entities.getAllGroups()){
|
||||
impl.switchContainer(group);
|
||||
}
|
||||
Timers.runTask(2f, () -> {
|
||||
impl.start(this::runLogic);
|
||||
this.enabled = true;
|
||||
@@ -99,9 +92,6 @@ public class ThreadHandler {
|
||||
}else{
|
||||
this.enabled = false;
|
||||
impl.stop();
|
||||
for(EntityGroup<?> group : Entities.getAllGroups()){
|
||||
group.setContainer(new ArrayContainer<>());
|
||||
}
|
||||
Timers.runTask(2f, () -> {
|
||||
logic.doUpdate = true;
|
||||
});
|
||||
@@ -175,6 +165,5 @@ public class ThreadHandler {
|
||||
void stop();
|
||||
void wait(Object object) throws InterruptedException;
|
||||
void notify(Object object);
|
||||
<T extends Entity> void switchContainer(EntityGroup<T> group);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -374,7 +374,7 @@ public class Player extends Unit implements BuilderTrait, CarryTrait, ShooterTra
|
||||
float wobblyness = 0.6f;
|
||||
trail.update(x + Angles.trnsx(rotation + 180f, 5f) + Mathf.range(wobblyness),
|
||||
y + Angles.trnsy(rotation + 180f, 5f) + Mathf.range(wobblyness));
|
||||
trail.draw(mech.trailColor, mech.trailColor, 5f * (isFlying() ? 1f : boostHeat));
|
||||
trail.draw(mech.trailColor, 5f * (isFlying() ? 1f : boostHeat));
|
||||
}else{
|
||||
trail.clear();
|
||||
}
|
||||
|
||||
@@ -76,7 +76,7 @@ public abstract class FlyingUnit extends BaseUnit implements CarryTrait{
|
||||
|
||||
@Override
|
||||
public void drawOver() {
|
||||
trail.draw(Palette.lightTrail, Palette.lightTrail, 5f);
|
||||
trail.draw(Palette.lightTrail, 5f);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -149,7 +149,7 @@ public class Drone extends FlyingUnit implements BuilderTrait {
|
||||
|
||||
@Override
|
||||
public void drawOver() {
|
||||
trail.draw(Palette.lightTrail, Palette.lightTrail, 3f);
|
||||
trail.draw(Palette.lightTrail, 3f);
|
||||
|
||||
TargetTrait entity = target;
|
||||
|
||||
|
||||
@@ -57,7 +57,7 @@ public class BlockRenderer{
|
||||
|
||||
int expandr = 4;
|
||||
|
||||
Graphics.surface(renderer.effectSurface);
|
||||
Graphics.surface(renderer.effectSurface, true, false);
|
||||
|
||||
int avgx = Mathf.scl(camera.position.x, tilesize);
|
||||
int avgy = Mathf.scl(camera.position.y, tilesize);
|
||||
|
||||
@@ -40,7 +40,8 @@ public class Trail {
|
||||
points.clear();
|
||||
}
|
||||
|
||||
public synchronized void draw(Color start, Color end, float stroke){
|
||||
public synchronized void draw(Color color, float stroke){
|
||||
Draw.color(color);
|
||||
|
||||
for(int i = 0; i < points.size - 2; i += 2){
|
||||
float x = points.get(i);
|
||||
@@ -49,8 +50,6 @@ public class Trail {
|
||||
float y2 = points.get(i + 3);
|
||||
float s = Mathf.clamp((float)(i) / points.size);
|
||||
|
||||
Draw.color(start, end, s);
|
||||
|
||||
Lines.stroke(s * stroke);
|
||||
Lines.line(x, y, x2, y2);
|
||||
}
|
||||
@@ -59,8 +58,6 @@ public class Trail {
|
||||
Fill.circle(points.get(points.size-2), points.get(points.size-1), stroke/2f);
|
||||
}
|
||||
|
||||
Draw.color(start);
|
||||
|
||||
Draw.reset();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package io.anuke.mindustry.ui;
|
||||
|
||||
import com.badlogic.gdx.utils.Align;
|
||||
import io.anuke.ucore.function.Listenable;
|
||||
import io.anuke.ucore.scene.ui.ImageButton;
|
||||
|
||||
@@ -10,6 +11,6 @@ public class MobileButton extends ImageButton {
|
||||
resizeImage(isize);
|
||||
clicked(listener);
|
||||
row();
|
||||
add(text).growX().wrap();
|
||||
add(text).growX().wrap().center().get().setAlignment(Align.center, Align.center);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user