New tile edge algorithms / Struct value type generation

This commit is contained in:
Anuken
2019-01-28 22:11:23 -05:00
parent 5a3ec8f407
commit 54bade668e
19 changed files with 7275 additions and 7459 deletions

View File

@@ -9,6 +9,7 @@ import io.anuke.mindustry.type.Item;
import io.anuke.mindustry.type.Mech;
import io.anuke.mindustry.world.Block;
import io.anuke.mindustry.world.Block.Icon;
import io.anuke.mindustry.world.blocks.Floor;
import io.anuke.mindustry.world.blocks.OreBlock;
import static io.anuke.mindustry.Vars.content;
@@ -143,6 +144,31 @@ public class Generators {
}
}
});
ImagePacker.generate("edges", () -> {
for(Block block : content.blocks()){
if(!(block instanceof Floor)) continue;
Floor floor = (Floor)block;
if(ImagePacker.has(floor.name + "-edge")){
continue;
}
try{
Image image = ImagePacker.get(floor.generateIcons()[0]);
Image edge = ImagePacker.get("edge-stencil");
for(int x = 0; x < edge.width(); x++){
for(int y = 0; y < edge.height(); y++){
edge.draw(x, y, edge.getColor(x, y).mul(image.getColor(x % image.width(), y % image.height())));
}
}
edge.save(floor.name + "-edge");
}catch(Exception ignored){}
}
});
}
}

View File

@@ -111,6 +111,10 @@ public class ImagePacker{
return get(Core.atlas.find(name));
}
static boolean has(String name){
return Core.atlas.has(name);
}
static Image get(TextureRegion region){
GenRegion.validate(region);