Basic map shading
This commit is contained in:
@@ -63,14 +63,7 @@ public class Maps implements Disposable{
|
||||
FileHandle file = Core.files.internal("maps/" + name + "." + mapExtension);
|
||||
|
||||
try(DataInputStream ds = new DataInputStream(file.read())) {
|
||||
MapMeta meta = MapIO.readMapMeta(ds);
|
||||
Map map = new Map(name, meta, false, file::read);
|
||||
|
||||
if (!headless){
|
||||
map.texture = new Texture(MapIO.generatePixmap(MapIO.readTileData(ds, meta, true)));
|
||||
}
|
||||
|
||||
return map;
|
||||
return new Map(name, MapIO.readMapMeta(ds), false, file::read);
|
||||
}catch(IOException e){
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
|
||||
@@ -12,5 +12,9 @@ public abstract class Generator{
|
||||
|
||||
public Generator(){}
|
||||
|
||||
public void init(){
|
||||
|
||||
}
|
||||
|
||||
public abstract void generate(Tile[][] tiles);
|
||||
}
|
||||
|
||||
@@ -10,9 +10,15 @@ import io.anuke.mindustry.world.Tile;
|
||||
import static io.anuke.mindustry.Vars.world;
|
||||
|
||||
public class MapGenerator extends Generator{
|
||||
private final Map map;
|
||||
private Map map;
|
||||
private String mapName;
|
||||
|
||||
public MapGenerator(String mapName){
|
||||
this.mapName = mapName;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init(){
|
||||
map = world.maps.loadInternalMap(mapName);
|
||||
width = map.meta.width;
|
||||
height = map.meta.height;
|
||||
|
||||
Reference in New Issue
Block a user