示例#1
0
        private void MakeBasicSurface()
        {
            var editor = new SadConsole.Surfaces.SurfaceEditor(basicSurface);

            editor.Print(0, 0, "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890".Repeat(9));

            ColorGradient gradient = new ColorGradient(StarterProject.Theme.Blue, StarterProject.Theme.Yellow);

            for (int i = 0; i < 510; i += 10)
            {
                var point = editor.TextSurface.GetPointFromIndex(i);
                editor.Print(point.X, point.Y, gradient.ToColoredString(editor.GetString(i, 10)));
            }

            // Mirror 1
            int startSet1 = new Point(0, 3).ToIndex(34);
            int startSet2 = new Point(0, 6).ToIndex(34);
            int startSet3 = new Point(0, 9).ToIndex(34);

            for (int i = 0; i < 34 * 3; i++)
            {
                basicSurface.Cells[startSet1 + i].Mirror     = Microsoft.Xna.Framework.Graphics.SpriteEffects.FlipVertically;
                basicSurface.Cells[startSet1 + i].Background = StarterProject.Theme.PurpleDark;

                basicSurface.Cells[startSet2 + i].Mirror     = Microsoft.Xna.Framework.Graphics.SpriteEffects.FlipHorizontally;
                basicSurface.Cells[startSet2 + i].Background = StarterProject.Theme.OrangeDark;

                basicSurface.Cells[startSet3 + i].Mirror     = Microsoft.Xna.Framework.Graphics.SpriteEffects.FlipHorizontally | Microsoft.Xna.Framework.Graphics.SpriteEffects.FlipVertically;
                basicSurface.Cells[startSet3 + i].Background = StarterProject.Theme.GreenDark;
            }
        }
示例#2
0
        private void MakeLayeredSurface()
        {
            var editor = new SadConsole.Surfaces.SurfaceEditor(layeredSurface);

            layeredSurface.SetActiveLayer(2);
            editor.Fill(StarterProject.Theme.Brown, StarterProject.Theme.BrownDark, 0);
            editor.Fill(new Rectangle(5, 2, 34 - 10, 15 - 4), Color.White, Color.Transparent, 0);
            editor.Print(14, 0, "Layer 2");

            layeredSurface.SetActiveLayer(1);
            editor.Fill(StarterProject.Theme.Green, StarterProject.Theme.GreenDark, 0);
            editor.Fill(new Rectangle(10, 4, 34 - 20, 15 - 8), Color.White, Color.Transparent, 0);
            editor.Print(14, 2, "Layer 1");

            layeredSurface.SetActiveLayer(0);
            editor.Fill(StarterProject.Theme.Gray, StarterProject.Theme.GrayDark, 0);
            editor.Print(14, 4, "Layer 0");
        }