mirror of
https://github.com/Anuken/Mindustry.git
synced 2026-01-28 07:22:21 -08:00
Fix rendering bug
This commit is contained in:
parent
569de6de8f
commit
cbcdc96aaa
3 changed files with 23 additions and 5 deletions
|
|
@ -218,7 +218,7 @@ public class Renderer extends RendererModule{
|
|||
Graphics.shader();
|
||||
|
||||
Entities.draw(Entities.defaultGroup());
|
||||
|
||||
|
||||
blocks.drawBlocks(true);
|
||||
|
||||
Entities.draw(control.bulletGroup);
|
||||
|
|
@ -317,6 +317,10 @@ public class Renderer extends RendererModule{
|
|||
Draw.color();
|
||||
}
|
||||
|
||||
public BlockRenderer getBlocks() {
|
||||
return blocks;
|
||||
}
|
||||
|
||||
public void addShieldHit(float x, float y){
|
||||
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.blocks.Blocks;
|
||||
import io.anuke.mindustry.world.blocks.types.StaticBlock;
|
||||
import io.anuke.ucore.UCore;
|
||||
import io.anuke.ucore.core.Core;
|
||||
import io.anuke.ucore.core.Draw;
|
||||
import io.anuke.ucore.core.Graphics;
|
||||
|
|
@ -48,6 +49,11 @@ public class BlockRenderer{
|
|||
public int compareTo(BlockRequest other){
|
||||
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.*/
|
||||
|
|
@ -114,17 +120,23 @@ public class BlockRenderer{
|
|||
Arrays.sort(requests.items, 0, requestidx);
|
||||
iterateidx = 0;
|
||||
}
|
||||
|
||||
public int getRequests(){
|
||||
return requestidx;
|
||||
}
|
||||
|
||||
public void drawBlocks(boolean top){
|
||||
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()){
|
||||
break;
|
||||
}
|
||||
|
||||
BlockRequest req = requests.get(iterateidx);
|
||||
Block block = req.tile.block();
|
||||
|
||||
if(req.layer == Layer.block){
|
||||
block.draw(req.tile);
|
||||
}else if(req.layer == block.layer){
|
||||
|
|
|
|||
|
|
@ -136,11 +136,13 @@ public class HudFragment implements Fragment{
|
|||
aleft();
|
||||
new label("[green]density: " + Gdx.graphics.getDensity()).left();
|
||||
row();
|
||||
new label(()->"[purple]tiles: " + Vars.control.tileGroup.amount()).left();
|
||||
new label(() -> "[blue]requests: " + renderer.getBlocks().getRequests()).left();
|
||||
row();
|
||||
new label(()->"[purple]enemies: " + Vars.control.enemyGroup.amount()).left();
|
||||
new label(() -> "[purple]tiles: " + Vars.control.tileGroup.amount()).left();
|
||||
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();
|
||||
new label("[red]DEBUG MODE").scale(0.5f).left();
|
||||
}}.end();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue