Exemple #1
0
        /// <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;
        }
Exemple #2
0
        /// <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);
        }
Exemple #3
0
        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);
        }
Exemple #4
0
        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;
        }