Minor clear optimization

This commit is contained in:
Anuken
2023-12-24 21:14:44 -05:00
parent 93d4eaa970
commit 3a64685280
2 changed files with 5 additions and 5 deletions

View File

@@ -1,5 +1,6 @@
package mindustry.world.blocks.logic;
import arc.*;
import arc.graphics.*;
import arc.graphics.g2d.*;
import arc.graphics.gl.*;
@@ -91,10 +92,9 @@ public class LogicDisplay extends Block{
switch(type){
case commandClear -> {
//calling glClear appears to be unreliable and leads to flickering
Draw.color(x / 255f, y / 255f, p1 / 255f, 1f);
Fill.crect(0f, 0f, displaySize, displaySize);
Draw.color(color);
//discard any pending batched sprites, so they don't get drawn over the cleared screen later
Draw.discard();
Core.graphics.clear(x / 255f, y / 255f, p1 / 255f, 1f);
}
case commandLine -> Lines.line(x, y, p1, p2);
case commandRect -> Fill.crect(x, y, p1, p2);