Minor fixes for markers and empty floor edges

This commit is contained in:
Anuken
2025-12-28 20:46:17 -05:00
parent c0d0419016
commit 011713cd25
3 changed files with 17 additions and 17 deletions

View File

@@ -12,6 +12,7 @@ public class EmptyFloor extends Floor{
canShadow = false;
placeableOn = false;
solid = true;
drawEdgeOut = false;
}
@Override

View File

@@ -51,6 +51,7 @@ public class CanvasBlock extends Block{
config(byte[].class, (CanvasBuild build, byte[] bytes) -> {
if(build.data.length == bytes.length){
System.arraycopy(bytes, 0, build.data, 0, bytes.length);
build.invalidated = true;
build.updateTexture();
}
});
@@ -149,19 +150,19 @@ public class CanvasBlock extends Block{
public @Nullable Texture texture;
public byte[] data = new byte[Mathf.ceil(canvasSize * canvasSize * bitsPerPixel / 8f)];
public int blending;
public boolean updated = false;
protected boolean invalidated = false;
public void setPixel(int pos, int index){
if(pos < canvasSize * canvasSize && pos >= 0 && index >= 0 && index < palette.length){
setByte(data, pos * bitsPerPixel, index);
updated = true;
invalidated = true;
}
}
public void setPixel(int x, int y, int index){
if(x >= 0 && y >= 0 && x < canvasSize && y < canvasSize && index >= 0 && index < palette.length){
setByte(data, (y * canvasSize + x) * bitsPerPixel, index);
updated = true;
invalidated = true;
}
}
@@ -180,7 +181,7 @@ public class CanvasBlock extends Block{
}
public void updateTexture(){
if(headless) return;
if(headless || (texture != null && !invalidated)) return;
Pixmap pix = makePixmap(data, previewPixmap);
if(texture != null){
@@ -188,6 +189,8 @@ public class CanvasBlock extends Block{
}else{
texture = new Texture(pix);
}
invalidated = false;
}
public byte[] packPixmap(Pixmap pixmap){
@@ -260,10 +263,10 @@ public class CanvasBlock extends Block{
super.draw();
}
if(texture == null || updated){
updated = false;
if(texture == null || invalidated){
updateTexture();
}
Tmp.tr1.set(texture);
float pad = blending == 0 ? padding : 0f;