/// <summary> /// Converts a REXPaint .xp file to a <see cref="Consoles.LayeredConsole">LayeredConsole</see> /// </summary> /// <returns>The converted console.</returns> public Consoles.LayeredConsole ToLayeredConsole() { var console = new Consoles.LayeredConsole(Layers.Length, Width, Height); for (int i = 0; i < Layers.Length; i++) console[i].CellData = Layers[i].ToCellSurface(); return console; }
/// <summary> /// Converts a REXPaint .xp file to a <see cref="Consoles.LayeredConsole">LayeredConsole</see> /// </summary> /// <returns>The converted console.</returns> public Consoles.LayeredConsole ToLayeredConsole() { var console = new Consoles.LayeredConsole(Layers.Length, Width, Height); for (int i = 0; i < Layers.Length; i++) { console[i].CellData = Layers[i].ToCellSurface(); } return(console); }
public Consoles.LayeredConsole ToLayeredConsole() { CheckDisposed(); Consoles.LayeredConsole console = null; Reader.BaseStream.Position = 0; var version = Reader.ReadInt32(); var layerCount = Reader.ReadInt32(); Microsoft.Xna.Framework.Color transparentColor = new Microsoft.Xna.Framework.Color(255, 0, 255); for (int layer = 0; layer < layerCount; layer++) { int width = Reader.ReadInt32(); int height = Reader.ReadInt32(); if (layer == 0) { console = new Consoles.LayeredConsole(layerCount, width, height); } var currentLayer = console[layer].CellData; for (int y = 0; y < height; y++) { for (int x = 0; x < width; x++) { var cell = currentLayer[y, x]; int character = Reader.ReadInt32(); Microsoft.Xna.Framework.Color foreground = new Microsoft.Xna.Framework.Color(Reader.ReadByte(), Reader.ReadByte(), Reader.ReadByte()); Microsoft.Xna.Framework.Color background = new Microsoft.Xna.Framework.Color(Reader.ReadByte(), Reader.ReadByte(), Reader.ReadByte()); if (background != transparentColor) { cell.CharacterIndex = character; cell.Foreground = foreground; cell.Background = background; } } } } return(console); }
public Consoles.LayeredConsole ToLayeredConsole() { CheckDisposed(); Consoles.LayeredConsole console = null; Reader.BaseStream.Position = 0; var version = Reader.ReadInt32(); var layerCount = Reader.ReadInt32(); Microsoft.Xna.Framework.Color transparentColor = new Microsoft.Xna.Framework.Color(255, 0, 255); for (int layer = 0; layer < layerCount; layer++) { int width = Reader.ReadInt32(); int height = Reader.ReadInt32(); if (layer == 0) { console = new Consoles.LayeredConsole(layerCount, width, height); } var currentLayer = console[layer].CellData; for (int y = 0; y < height; y++) { for (int x = 0; x < width; x++) { var cell = currentLayer[y, x]; int character = Reader.ReadInt32(); Microsoft.Xna.Framework.Color foreground = new Microsoft.Xna.Framework.Color(Reader.ReadByte(), Reader.ReadByte(), Reader.ReadByte()); Microsoft.Xna.Framework.Color background = new Microsoft.Xna.Framework.Color(Reader.ReadByte(), Reader.ReadByte(), Reader.ReadByte()); if (background != transparentColor) { cell.CharacterIndex = character; cell.Foreground = foreground; cell.Background = background; } } } } return console; }