Basic map shading

This commit is contained in:
Anuken
2019-01-16 20:37:43 -05:00
parent 4344af1f02
commit 6d50a747e3
12 changed files with 66 additions and 23 deletions

View File

@@ -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);
}

View File

@@ -12,5 +12,9 @@ public abstract class Generator{
public Generator(){}
public void init(){
}
public abstract void generate(Tile[][] tiles);
}

View File

@@ -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;