Fix rendering bug
This commit is contained in:
@@ -317,6 +317,10 @@ public class Renderer extends RendererModule{
|
|||||||
Draw.color();
|
Draw.color();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public BlockRenderer getBlocks() {
|
||||||
|
return blocks;
|
||||||
|
}
|
||||||
|
|
||||||
public void addShieldHit(float x, float y){
|
public void addShieldHit(float x, float y){
|
||||||
shieldHits.addAll(x, y, 0f);
|
shieldHits.addAll(x, y, 0f);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,6 +17,7 @@ import io.anuke.mindustry.core.GameState.State;
|
|||||||
import io.anuke.mindustry.world.*;
|
import io.anuke.mindustry.world.*;
|
||||||
import io.anuke.mindustry.world.blocks.Blocks;
|
import io.anuke.mindustry.world.blocks.Blocks;
|
||||||
import io.anuke.mindustry.world.blocks.types.StaticBlock;
|
import io.anuke.mindustry.world.blocks.types.StaticBlock;
|
||||||
|
import io.anuke.ucore.UCore;
|
||||||
import io.anuke.ucore.core.Core;
|
import io.anuke.ucore.core.Core;
|
||||||
import io.anuke.ucore.core.Draw;
|
import io.anuke.ucore.core.Draw;
|
||||||
import io.anuke.ucore.core.Graphics;
|
import io.anuke.ucore.core.Graphics;
|
||||||
@@ -48,6 +49,11 @@ public class BlockRenderer{
|
|||||||
public int compareTo(BlockRequest other){
|
public int compareTo(BlockRequest other){
|
||||||
return layer.compareTo(other.layer);
|
return layer.compareTo(other.layer);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString(){
|
||||||
|
return tile.block().name + ":" + layer.toString();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**Process all blocks to draw, simultaneously drawing block shadows and static blocks.*/
|
/**Process all blocks to draw, simultaneously drawing block shadows and static blocks.*/
|
||||||
@@ -115,16 +121,22 @@ public class BlockRenderer{
|
|||||||
iterateidx = 0;
|
iterateidx = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public int getRequests(){
|
||||||
|
return requestidx;
|
||||||
|
}
|
||||||
|
|
||||||
public void drawBlocks(boolean top){
|
public void drawBlocks(boolean top){
|
||||||
Layer stopAt = top ? Layer.laser : Layer.overlay;
|
Layer stopAt = top ? Layer.laser : Layer.overlay;
|
||||||
|
|
||||||
for(; iterateidx < requests.size; iterateidx ++){
|
for(; iterateidx < requestidx; iterateidx ++){
|
||||||
|
|
||||||
if(iterateidx < requests.size - 1 && requests.get(iterateidx).layer.ordinal() > stopAt.ordinal()){
|
if(iterateidx < requests.size - 1 && requests.get(iterateidx).layer.ordinal() > stopAt.ordinal()){
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
BlockRequest req = requests.get(iterateidx);
|
BlockRequest req = requests.get(iterateidx);
|
||||||
Block block = req.tile.block();
|
Block block = req.tile.block();
|
||||||
|
|
||||||
if(req.layer == Layer.block){
|
if(req.layer == Layer.block){
|
||||||
block.draw(req.tile);
|
block.draw(req.tile);
|
||||||
}else if(req.layer == block.layer){
|
}else if(req.layer == block.layer){
|
||||||
|
|||||||
@@ -136,11 +136,13 @@ public class HudFragment implements Fragment{
|
|||||||
aleft();
|
aleft();
|
||||||
new label("[green]density: " + Gdx.graphics.getDensity()).left();
|
new label("[green]density: " + Gdx.graphics.getDensity()).left();
|
||||||
row();
|
row();
|
||||||
new label(()->"[purple]tiles: " + Vars.control.tileGroup.amount()).left();
|
new label(() -> "[blue]requests: " + renderer.getBlocks().getRequests()).left();
|
||||||
row();
|
row();
|
||||||
new label(()->"[purple]enemies: " + Vars.control.enemyGroup.amount()).left();
|
new label(() -> "[purple]tiles: " + Vars.control.tileGroup.amount()).left();
|
||||||
row();
|
row();
|
||||||
new label(()->"[orange]noclip: " + Vars.noclip).left();
|
new label(() -> "[purple]enemies: " + Vars.control.enemyGroup.amount()).left();
|
||||||
|
row();
|
||||||
|
new label(() -> "[orange]noclip: " + Vars.noclip).left();
|
||||||
row();
|
row();
|
||||||
new label("[red]DEBUG MODE").scale(0.5f).left();
|
new label("[red]DEBUG MODE").scale(0.5f).left();
|
||||||
}}.end();
|
}}.end();
|
||||||
|
|||||||
Reference in New Issue
Block a user