mirror of
https://github.com/Anuken/Mindustry.git
synced 2025-07-28 05:37:49 +07:00
progress
This commit is contained in:
@ -188,29 +188,38 @@ public class Renderer implements ApplicationListener{
|
||||
|
||||
Draw.proj(camera);
|
||||
|
||||
blocks.floor.checkChanges();
|
||||
blocks.processBlocks();
|
||||
|
||||
Draw.sort(true);
|
||||
|
||||
//beginFx();
|
||||
|
||||
drawBackground();
|
||||
Draw.draw(Layer.background, this::drawBackground);
|
||||
Draw.draw(Layer.floor, blocks.floor::drawFloor);
|
||||
Draw.draw(Layer.block - 1, blocks::drawShadows);
|
||||
Draw.draw(Layer.block, () -> {
|
||||
blocks.floor.beginDraw();
|
||||
blocks.floor.drawLayer(CacheLayer.walls);
|
||||
blocks.floor.endDraw();
|
||||
});
|
||||
|
||||
blocks.floor.checkChanges();
|
||||
blocks.floor.drawFloor();
|
||||
if(state.rules.lighting){
|
||||
Draw.draw(Layer.light, lights::draw);
|
||||
}
|
||||
|
||||
//Groups.drawFloor();
|
||||
//Groups.drawFloorOver();
|
||||
if(state.rules.drawDarkness){
|
||||
Draw.draw(Layer.darkness, blocks::drawDarkness);
|
||||
}
|
||||
|
||||
blocks.processBlocks();
|
||||
blocks.drawShadows();
|
||||
Draw.color();
|
||||
|
||||
blocks.floor.beginDraw();
|
||||
blocks.floor.drawLayer(CacheLayer.walls);
|
||||
blocks.floor.endDraw();
|
||||
if(bloom != null){
|
||||
Draw.draw(Layer.bullet - 0.001f, bloom::capture);
|
||||
Draw.draw(Layer.effect + 0.001f, bloom::render);
|
||||
}
|
||||
|
||||
blocks.drawBlocks();
|
||||
|
||||
//draw stuff
|
||||
Groups.draw.draw(Drawc::draw);
|
||||
|
||||
Draw.reset();
|
||||
Draw.flush();
|
||||
|
@ -13,6 +13,7 @@ import mindustry.core.*;
|
||||
import mindustry.entities.units.*;
|
||||
import mindustry.game.*;
|
||||
import mindustry.gen.*;
|
||||
import mindustry.graphics.*;
|
||||
import mindustry.net.Administration.*;
|
||||
import mindustry.net.*;
|
||||
import mindustry.net.Packets.*;
|
||||
@ -23,7 +24,7 @@ import static mindustry.Vars.*;
|
||||
|
||||
@EntityDef(value = {Playerc.class}, serialize = false)
|
||||
@Component
|
||||
abstract class PlayerComp implements UnitController, Entityc, Syncc, Timerc{
|
||||
abstract class PlayerComp implements UnitController, Entityc, Syncc, Timerc, Drawc{
|
||||
@NonNull @ReadOnly Unitc unit = Nulls.unit;
|
||||
|
||||
@ReadOnly Team team = Team.sharded;
|
||||
@ -58,6 +59,12 @@ abstract class PlayerComp implements UnitController, Entityc, Syncc, Timerc{
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public float clipSize(){
|
||||
return 20;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update(){
|
||||
if(unit.dead()){
|
||||
clearUnit();
|
||||
@ -130,7 +137,10 @@ abstract class PlayerComp implements UnitController, Entityc, Syncc, Timerc{
|
||||
con.kick(reason);
|
||||
}
|
||||
|
||||
void drawName(){
|
||||
@Override
|
||||
public void draw(){
|
||||
Draw.z(Layer.playerName);
|
||||
|
||||
BitmapFont font = Fonts.def;
|
||||
GlyphLayout layout = Pools.obtain(GlyphLayout.class, GlyphLayout::new);
|
||||
final float nameHeight = 11;
|
||||
|
@ -81,7 +81,7 @@ public class Rules{
|
||||
public boolean canGameOver = true;
|
||||
/** Whether to draw shadows of blocks at map edges and static blocks.
|
||||
* Do not change unless you know exactly what you are doing.*/
|
||||
public boolean drawFog = true;
|
||||
public boolean drawDarkness = true;
|
||||
/** Starting items put in cores */
|
||||
public Array<ItemStack> loadout = Array.with(ItemStack.with(Items.copper, 100));
|
||||
/** Blocks that cannot be placed. */
|
||||
|
@ -26,7 +26,7 @@ public class BlockRenderer implements Disposable{
|
||||
|
||||
public final FloorRenderer floor = new FloorRenderer();
|
||||
|
||||
private Array<Tile> requests = new Array<>(initialRequests);
|
||||
private Array<Tile> requests = new Array<>(false, initialRequests, Tile.class);
|
||||
|
||||
private int lastCamX, lastCamY, lastRangeX, lastRangeY;
|
||||
private float brokenFade = 0f;
|
||||
@ -94,7 +94,7 @@ public class BlockRenderer implements Disposable{
|
||||
});
|
||||
}
|
||||
|
||||
public void drawFog(){
|
||||
public void drawDarkness(){
|
||||
float ww = world.width() * tilesize, wh = world.height() * tilesize;
|
||||
float x = camera.position.x + tilesize / 2f, y = camera.position.y + tilesize / 2f;
|
||||
float u = (x - camera.width / 2f) / ww,
|
||||
@ -226,7 +226,10 @@ public class BlockRenderer implements Disposable{
|
||||
Block block = tile.block();
|
||||
Tilec entity = tile.entity;
|
||||
|
||||
Draw.z(Layer.block);
|
||||
|
||||
block.drawBase(tile);
|
||||
|
||||
if(entity != null){
|
||||
if(entity.damaged()){
|
||||
entity.drawCracks();
|
||||
|
@ -38,6 +38,9 @@ public class Layer{
|
||||
//building plans
|
||||
plans = 80,
|
||||
|
||||
//darkness over block clusters
|
||||
darkness = 85,
|
||||
|
||||
//flying units
|
||||
flyingUnit = 90,
|
||||
|
||||
|
@ -102,24 +102,26 @@ public class BlockForge extends Block{
|
||||
}
|
||||
|
||||
if(recipe != null){
|
||||
TextureRegion region = recipe.icon(Cicon.full);
|
||||
Draw.draw(Layer.blockOver, () -> {
|
||||
TextureRegion region = recipe.icon(Cicon.full);
|
||||
|
||||
Shaders.build.region = region;
|
||||
Shaders.build.progress = progress / recipe.buildCost;
|
||||
Shaders.build.color.set(Pal.accent);
|
||||
Shaders.build.color.a = heat;
|
||||
Shaders.build.time = -time / 20f;
|
||||
Shaders.build.region = region;
|
||||
Shaders.build.progress = progress / recipe.buildCost;
|
||||
Shaders.build.color.set(Pal.accent);
|
||||
Shaders.build.color.a = heat;
|
||||
Shaders.build.time = -time / 20f;
|
||||
|
||||
Draw.shader(Shaders.build);
|
||||
Draw.rect(region, x, y);
|
||||
Draw.shader();
|
||||
Draw.shader(Shaders.build);
|
||||
Draw.rect(region, x, y);
|
||||
Draw.shader();
|
||||
|
||||
Draw.color(Pal.accent);
|
||||
Draw.alpha(heat);
|
||||
Draw.color(Pal.accent);
|
||||
Draw.alpha(heat);
|
||||
|
||||
Lines.lineAngleCenter(x + Mathf.sin(time, 20f, Vars.tilesize / 2f * size - 2f), y, 90, size * Vars.tilesize - 4f);
|
||||
Lines.lineAngleCenter(x + Mathf.sin(time, 20f, Vars.tilesize / 2f * size - 2f), y, 90, size * Vars.tilesize - 4f);
|
||||
|
||||
Draw.reset();
|
||||
Draw.reset();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -197,8 +197,9 @@ public class CoreBlock extends StorageBlock{
|
||||
super.draw();
|
||||
|
||||
if(heat > 0.001f){
|
||||
Draw.z(Layer.blockOver);
|
||||
Drawf.drawRespawn(this, heat, progress, time, unitType, lastRequested);
|
||||
Draw.draw(Layer.blockOver, () -> {
|
||||
Drawf.drawRespawn(this, heat, progress, time, unitType, lastRequested);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user