Exemplo n.º 1
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.º 2
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.º 3
0
        public SerializationTests()
        {
            controlsConsole = new ControlsConsole(80, 4);

            masterView = new Console(34, 15);
            loadedView = new Console(34, 15);

            masterView.Fill(Color.White, Color.Red, 0);
            loadedView.Fill(Color.White, Color.Blue, 0);

            UseMouse = true;

            // Add the consoles to the list.
            Children.Add(controlsConsole);
            Children.Add(masterView);
            Children.Add(loadedView);

            // Setup main view
            masterView.Position = new Point(3, 6);

            // Setup sub view
            loadedView.Position = new Point(80 - 37, 6);


            // Setup controls
            controlsConsole.Position = new Point(0, 0);

            optionButtonSurface = new SadConsole.Controls.RadioButton(18, 1)
            {
                Text     = "Surface",
                Position = new Point(1, 1),
            };
            optionButtonSurface.IsSelectedChanged += OptionButton_IsSelectedChanged;
            controlsConsole.Add(optionButtonSurface);

            optionButtonView = new SadConsole.Controls.RadioButton(18, 1)
            {
                Text     = "Surface View",
                Position = new Point(1, 2)
            };
            optionButtonView.IsSelectedChanged += OptionButton_IsSelectedChanged;
            controlsConsole.Add(optionButtonView);

            optionButtonLayered = new SadConsole.Controls.RadioButton(21, 1)
            {
                Text     = "Layered Surface",
                Position = new Point(optionButtonSurface.Bounds.Right + 1, 1)
            };
            optionButtonLayered.IsSelectedChanged += OptionButton_IsSelectedChanged;
            controlsConsole.Add(optionButtonLayered);

            optionButtonAnimated = new SadConsole.Controls.RadioButton(21, 1)
            {
                Text     = "Animated Surface",
                Position = new Point(optionButtonSurface.Bounds.Right + 1, 2)
            };
            optionButtonAnimated.IsSelectedChanged += OptionButton_IsSelectedChanged;
            controlsConsole.Add(optionButtonAnimated);

            var buttonSave = new SadConsole.Controls.Button(17)
            {
                Text     = "Save and Load",
                Position = new Point(controlsConsole.Width - 19, 1)
            };

            buttonSave.Click += ButtonSave_Click;
            controlsConsole.Add(buttonSave);

            basicSurface    = new SadConsole.Surfaces.BasicSurface(34, 15);
            layeredSurface  = new SadConsole.Surfaces.LayeredSurface(34, 15, 3);
            animatedSurface = SadConsole.GameHelpers.Animations.CreateStatic(34, 15, 15, 0.3d);
            viewSurface     = new SadConsole.Surfaces.SurfaceView(basicSurface, new Rectangle(5, 2, 34 - 10, 15 - 4));
            emptySurface    = (SadConsole.Surfaces.BasicSurface)loadedView.TextSurface;

            MakeBasicSurface();
            MakeLayeredSurface();
        }