public static void WriteTilemap(this BinaryStream stream, GbaTilemap tilemap) { for (int y = 0; y < tilemap.Height; y++) { for (int x = 0; x < tilemap.Width; x++) { stream.WriteTileInfo(tilemap[x, y]); } } }
public static GbaTilemap ReadTilemap(this BinaryStream stream, int width, int height) { var tilemap = new GbaTilemap(width, height); for (int y = 0; y < height; y++) { for (int x = 0; x < width; x++) { tilemap[x, y] = stream.ReadTileInfo(); } } return(tilemap); }