public TileSet(TileSetInfo info, Texture2D texture) { this.info = info; this.texture = texture; tiles = new Tile[info.Width * info.Height]; w = info.Width; h = info.Height; clearSet(); }
public static TileSetInfo loadFromStream(System.IO.Stream stream) { System.IO.BinaryReader reader = new System.IO.BinaryReader(stream); uint width = uint.Parse(Utility.readToBrakpoint(reader)); uint height = uint.Parse(Utility.readToBrakpoint(reader)); TileSetInfo info = new TileSetInfo(width, height); stream.Close(); return(info); }
public static TileSet loadFromTexture(Texture2D texture, TileSetInfo info, TileMask[] masks) { TileSet ts = new TileSet(info, texture); for (uint y = 0; y < ts.Height; y++) { for (uint x = 0; x < ts.Width; x++) { ts.setTile(x, y, new Tile(ts, masks[x + y * ts.Width], x + y * ts.Width)); } } return(ts); }