Exemplo n.º 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;
            }
        }
Exemplo n.º 2
0
        public BorderedConsole(int width, int height)
            : base(width - 2, height - 2)
        {
            borderSurface = new SadConsole.Surfaces.BasicSurface(width, height);

            var editor = new SadConsole.Surfaces.SurfaceEditor(borderSurface);
            var box    = SadConsole.Shapes.Box.GetDefaultBox();

            box.Width  = borderSurface.Width;
            box.Height = borderSurface.Height;
            box.Draw(editor);

            base.Renderer.Render(borderSurface);
        }
Exemplo n.º 3
0
        private void SetBorderConsole()
        {
            borderSurface = new SadConsole.Surfaces.BasicSurface(Width, Height, textSurface.Font);
            var editor = new SadConsole.Surfaces.SurfaceEditor(borderSurface);

            SadConsole.Shapes.Box box = SadConsole.Shapes.Box.Thick();

            box.Width            = borderSurface.Width;
            box.Height           = borderSurface.Height;
            box.Foreground       = Resources.Palette.Rope;
            box.BorderBackground = TextSurface.DefaultBackground;
            Border = box;
            Border.Draw(editor);
            //box.Draw(editor);
            Renderer.Render(borderSurface);
        }
Exemplo n.º 4
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");
        }