public WindowTestConsole()
            : base(80, 25)
        {
            this.IsVisible = false;

            this.VirtualCursor.Position = new Point(3, 1);
            this.VirtualCursor.Print("This console can configure a window for popup. It also demonstrates some \r\n   basic UI controls.");

            // This is set becuase when the window pops up, this console loses focus and it shifts focus to the window.
            // Normally consoles do not receive focus when you click on them with the mouse, so you cannot interact
            // with this console after the window has been shown. This allos the console to get focus again if you click
            // behind the window.
            this.CanFocus      = true;
            this.MouseCanFocus = true;

            // Configure our window button
            var button = new SadConsole.Controls.Button(8, 1)
            {
                Text          = "Show",
                TextAlignment = System.Windows.HorizontalAlignment.Center,
                Position      = new Point(3, 6),
            };

            button.ButtonClicked += button_ButtonClicked;

            // After it has been configured, add it to this controls console so it is rendered and can be interacted with.
            this.Add(button);

            // Create the window. It will not be shown after being created. We will use the button to do that.
            CreateWindow();
        }
        public WindowTestConsole()
            : base(80, 25)
        {
            this.IsVisible = false;

            this.VirtualCursor.Position = new Point(3, 1);
            this.VirtualCursor.Print("This console can configure a window for popup. It also demonstrates some \r\n   basic UI controls.");

            // This is set becuase when the window pops up, this console loses focus and it shifts focus to the window.
            // Normally consoles do not receive focus when you click on them with the mouse, so you cannot interact
            // with this console after the window has been shown. This allos the console to get focus again if you click
            // behind the window.
            this.CanFocus = true;
            this.MouseCanFocus = true;

            // Configure our window button
            var button = new SadConsole.Controls.Button(8, 1)
            {
                Text = "Show",
                TextAlignment = System.Windows.HorizontalAlignment.Center,
                Position = new Point(3, 6),
            };
            button.ButtonClicked += button_ButtonClicked;

            // After it has been configured, add it to this controls console so it is rendered and can be interacted with.
            this.Add(button);

            // Create the window. It will not be shown after being created. We will use the button to do that.
            CreateWindow();
        }
        private void CreateWindow()
        {
            _window = new SadConsole.Consoles.Window(30, 10);
            _window.Title = " Popup Window 1 ";

            var closeButton = new SadConsole.Controls.Button(7, 1);
            closeButton.Text = "Close";
            closeButton.Position = new Point(_window.CellData.Width - 2 - closeButton.Width, _window.CellData.Height - 2);
            closeButton.ButtonClicked += (sender, e) => { _window.Hide(); };

            _window.Add(closeButton);
            _window.Center();
        }
        private void CreateWindow()
        {
            _window       = new SadConsole.Consoles.Window(30, 10);
            _window.Title = " Popup Window 1 ";

            var closeButton = new SadConsole.Controls.Button(7, 1);

            closeButton.Text           = "Close";
            closeButton.Position       = new Point(_window.CellData.Width - 2 - closeButton.Width, _window.CellData.Height - 2);
            closeButton.ButtonClicked += (sender, e) => { _window.Hide(); };

            _window.Add(closeButton);
            _window.Center();
        }
        private void SetWindowProperties()
        {
            Theme.BorderStyle = new Cell(Resources.Palette.Rope, Resources.Palette.Loulou);
            Theme.FillStyle   = new Cell(Resources.Palette.LightSteelBlue, Resources.Palette.Loulou);
            Theme.TitleStyle  = new Cell(Resources.Palette.GoldenFizz, Resources.Palette.Loulou);
            Title             = Sender.Name;

            var okButton = new SadConsole.Controls.Button(5);

            okButton.Text     = "Ok!";
            okButton.Position = new Microsoft.Xna.Framework.Point(Width / 2 - okButton.Width / 2, Height - okButton.Height - 1);
            okButton.Click   += OkButton_Click;
            Add(okButton);
        }
Beispiel #6
0
        public void UpdateMenuList()
        {
            menuControls.RemoveAll();

            int buttonPosition = 1;

            currentButton = -1;
            buttons.Clear();

            // Continue game button
            if (GameLogic.GameMapScreen != null)
            {
                SadConsole.Controls.Button continueGameButton = new SadConsole.Controls.Button(16);
                continueGameButton.Text     = "Continue Game";
                continueGameButton.Position = new Microsoft.Xna.Framework.Point(2, buttonPosition);
                buttonPosition           += 2;
                continueGameButton.Click += ContinueGameButtonClicked;
                menuControls.Add(continueGameButton);
                buttons.Add(continueGameButton);
            }

            // New game button
            SadConsole.Controls.Button newGameButton = new SadConsole.Controls.Button(16);
            newGameButton.Text     = "New Game";
            newGameButton.Position = new Microsoft.Xna.Framework.Point(2, buttonPosition);
            buttonPosition        += 2;
            newGameButton.Click   += NewGameButtonClicked;
            menuControls.Add(newGameButton);
            buttons.Add(newGameButton);

            // Exit game button
            SadConsole.Controls.Button exitGameButton = new SadConsole.Controls.Button(16);
            exitGameButton.Text     = "Exit";
            exitGameButton.Position = new Microsoft.Xna.Framework.Point(2, buttonPosition);
            buttonPosition         += 2;
            exitGameButton.Click   += ExitGameButtonClicked;
            menuControls.Add(exitGameButton);
            buttons.Add(exitGameButton);
        }
Beispiel #7
0
        protected override void Initialize()
        {
            // Generally you don't want to hide the mouse from the user
            IsMouseVisible = true;

            // Finish the initialization of SadConsole
            base.Initialize();

            RandomWrapper randomWrapper = new RandomWrapper(2);

            RandomNumberServiceLocator.Provide(randomWrapper);

            // Create the map
            AdventureScreen = new AdventureScreen();
            AdventureScreen.LoadMap(MapGenerator.Generate(200, 200));
            AdventureScreen.SpawnPlayer();

            SadConsole.ControlsConsole startingConsole = new SadConsole.ControlsConsole(SCREEN_WIDTH, SCREEN_HEIGHT);

            var bt1 = new SadConsole.Controls.Button(5);

            startingConsole.Add(bt1);

            SadConsole.Global.CurrentScreen = startingConsole;

            SadConsole.Global.CurrentScreen.Children.Add(AdventureScreen);

            //SimplexNoiseViewer simplexNoiseViewer = new SimplexNoiseViewer(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT);
            //simplexNoiseViewer.LoadMap(200, 200, 0.03f);
            //SadConsole.Global.CurrentScreen = simplexNoiseViewer;

            //SadConsole.Window window = new SadConsole.Window(10, 10);
            //window.Title = "status";
            //window.Dragable = true;
            //window.Show();
            //SadConsole.Global.CurrentScreen = startingConsole;
            //SadConsole.Global.CurrentScreen.Children.Add(window);
        }
Beispiel #8
0
        private void InitializeControls()
        {
            browseForLauncherButton = new StandardButton(20)
            {
                Position = new Point(2, 6),
                Text     = "[B] Browse"
            };
            browseForLauncherButton.Click += (sender, args) => BrowseEditor?.Invoke(this, EventArgs.Empty);
            Add(browseForLauncherButton);

            closeButton = new StandardButton(20)
            {
                Position = new Point(2, Height - 4),
                Text     = "[ESC] Close"
            };
            closeButton.Click += (sender, args) => Exit?.Invoke(this, EventArgs.Empty);
            Add(closeButton);

            prevFontSizeButton = new Button(1)
            {
                Position = new Point(13, 10),
                Text     = "<",
                CanFocus = false,
            };
            prevFontSizeButton.Click += (sender, args) => DecreaseFontSize?.Invoke(this, EventArgs.Empty);
            Add(prevFontSizeButton);

            nextFontSizeButton = new Button(1)
            {
                Position = new Point(21, 10),
                Text     = ">",
                CanFocus = false
            };
            nextFontSizeButton.Click += (sender, args) => IncreaseFontSize?.Invoke(this, EventArgs.Empty);
            Add(nextFontSizeButton);
        }
Beispiel #9
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();
        }
Beispiel #10
0
        public ControlsTest() : base(80, 25)
        {
            IsVisible = false;


            var button1 = new SadConsole.Controls.Button(11, 1);

            button1.Text           = "Click";
            button1.Position       = new Point(1, 3);
            button1.ButtonClicked += (s, e) => Window.Message("Clicked!", "OK");
            Add(button1);

            var radioButton = new SadConsole.Controls.RadioButton(20, 1);

            radioButton.Text     = "Group 1 Option 1";
            radioButton.Position = new Point(1, 5);
            Add(radioButton);

            radioButton          = new SadConsole.Controls.RadioButton(20, 1);
            radioButton.Text     = "Group 1 Option 2";
            radioButton.Position = new Point(1, 7);
            Add(radioButton);

            radioButton           = new SadConsole.Controls.RadioButton(20, 1);
            radioButton.Text      = "Group 2 Option 1";
            radioButton.Position  = new Point(1, 9);
            radioButton.GroupName = "group2";
            Add(radioButton);

            radioButton           = new SadConsole.Controls.RadioButton(20, 1);
            radioButton.Text      = "Group 2 Option 2";
            radioButton.Position  = new Point(1, 11);
            radioButton.GroupName = "group2";
            Add(radioButton);

            var checkbox = new SadConsole.Controls.CheckBox(13, 1);

            checkbox.Text     = "Check box";
            checkbox.Position = new Point(1, 13);
            Add(checkbox);

            var listbox = new SadConsole.Controls.ListBox(20, 6);

            listbox.Position   = new Point(25, 3);
            listbox.HideBorder = false;
            listbox.Items.Add("item 1");
            listbox.Items.Add("item 2");
            listbox.Items.Add("item 3");
            listbox.Items.Add("item 4");
            listbox.Items.Add("item 5");
            listbox.Items.Add("item 6");
            listbox.Items.Add("item 7");
            listbox.Items.Add("item 8");
            Add(listbox);

            var slider = SadConsole.Controls.ScrollBar.Create(System.Windows.Controls.Orientation.Horizontal, 20);

            slider.Position = new Point(25, 10);
            slider.Maximum  = 18;
            Add(slider);

            slider          = SadConsole.Controls.ScrollBar.Create(System.Windows.Controls.Orientation.Vertical, 8);
            slider.Position = new Point(47, 3);
            slider.Maximum  = 6;
            Add(slider);

            var input = new SadConsole.Controls.InputBox(20);

            input.Position = new Point(25, 12);
            Add(input);

            var selButton = new SadConsole.Controls.SelectionButton(20, 1);

            selButton.Text     = "Selection Button 1";
            selButton.Position = new Point(55, 3);
            Add(selButton);

            var selButton1 = new SadConsole.Controls.SelectionButton(20, 1);

            selButton1.Text     = "Selection Button 2";
            selButton1.Position = new Point(55, 4);
            Add(selButton1);

            var selButton2 = new SadConsole.Controls.SelectionButton(20, 1);

            selButton2.Text     = "Selection Button 3";
            selButton2.Position = new Point(55, 5);
            Add(selButton2);

            var selButton3 = new SadConsole.Controls.SelectionButton(20, 1);

            selButton3.Text     = "Selection Button 4";
            selButton3.Position = new Point(55, 6);
            Add(selButton3);

            var selButton4 = new SadConsole.Controls.SelectionButton(20, 1);

            selButton4.Text     = "Selection Button 5";
            selButton4.Position = new Point(55, 7);
            Add(selButton4);

            selButton.PreviousSelection  = selButton4;
            selButton.NextSelection      = selButton1;
            selButton1.PreviousSelection = selButton;
            selButton1.NextSelection     = selButton2;
            selButton2.PreviousSelection = selButton1;
            selButton2.NextSelection     = selButton3;
            selButton3.PreviousSelection = selButton2;
            selButton3.NextSelection     = selButton4;
            selButton4.PreviousSelection = selButton3;
            selButton4.NextSelection     = selButton;

            FocusedControl = null;
            //DisableControlFocusing = true;

            List <Tuple <Color, string> > colors = new List <Tuple <Color, string> >();

            colors.Add(new Tuple <Color, string>(StarterProject.Theme.Red, "Red"));
            colors.Add(new Tuple <Color, string>(StarterProject.Theme.RedDark, "DRed"));
            colors.Add(new Tuple <Color, string>(StarterProject.Theme.Purple, "Prp"));
            colors.Add(new Tuple <Color, string>(StarterProject.Theme.PurpleDark, "DPrp"));
            colors.Add(new Tuple <Color, string>(StarterProject.Theme.Blue, "Blu"));
            colors.Add(new Tuple <Color, string>(StarterProject.Theme.BlueDark, "DBlu"));
            colors.Add(new Tuple <Color, string>(StarterProject.Theme.Cyan, "Cya"));
            colors.Add(new Tuple <Color, string>(StarterProject.Theme.CyanDark, "DCya"));
            colors.Add(new Tuple <Color, string>(StarterProject.Theme.Green, "Gre"));
            colors.Add(new Tuple <Color, string>(StarterProject.Theme.GreenDark, "DGre"));
            colors.Add(new Tuple <Color, string>(StarterProject.Theme.Yellow, "Yel"));
            colors.Add(new Tuple <Color, string>(StarterProject.Theme.YellowDark, "DYel"));
            colors.Add(new Tuple <Color, string>(StarterProject.Theme.Orange, "Ora"));
            colors.Add(new Tuple <Color, string>(StarterProject.Theme.OrangeDark, "DOra"));
            colors.Add(new Tuple <Color, string>(StarterProject.Theme.Brown, "Bro"));
            colors.Add(new Tuple <Color, string>(StarterProject.Theme.BrownDark, "DBrow"));
            colors.Add(new Tuple <Color, string>(StarterProject.Theme.Gray, "Gray"));
            colors.Add(new Tuple <Color, string>(StarterProject.Theme.GrayDark, "DGray"));
            colors.Add(new Tuple <Color, string>(StarterProject.Theme.White, "White"));
            colors.Add(new Tuple <Color, string>(StarterProject.Theme.Black, "Black"));

            backgroundcycle = colors.Select(i => i.Item1).ToArray();
            backIndex       = 5;


            //int y = 25 - 20;
            //int x = 0;
            //int colorLength = 4;
            //foreach (var color1 in colors)
            //{
            //    foreach (var color2 in colors)
            //    {
            //        _Print(x, y, new ColoredString(color2.Item2.PadRight(colorLength).Substring(0, colorLength), color2.Item1, color1.Item1, null));
            //        y++;
            //    }

            //    y = 25 -20;
            //    x += colorLength;
            //}
        }
Beispiel #11
0
        public StatusConsole(int screenX, int screenY, int screenWidth, int screenHeight) : base(screenWidth, screenHeight)
        {
            Position = new Point(screenX, screenY);
            Width    = screenWidth;
            Height   = screenHeight;

            var lines = new[]
            {
                @"_______",
                @"|     |",
                @"| [H] |",
                @"|_____|",
                @"| |",
                @"=============",
                @"//  |     |  \\",
                @"[LAL]  |     |  [RAL]",
                @"//    | [D] |    \\",
                @"[LH]    |     |    [RH]",
                @"|     |",
                @"=======",
                @"//    \\",
                @"//      \\",
                @"[LLL]      [RLL]",
                @"//          \\",
                @"//            \\",
                @"[LF]            [RF]"
            };

            var offsets = new[]
            {
                10,
                10,
                10,
                10,
                12,
                7,
                6,
                3,
                4,
                2,
                10,
                10,
                9,
                8,
                5,
                6,
                5,
                3
            };

            for (int i = 0; i < lines.Length; i++)
            {
                Print(offsets[i], i, lines[i]);
            }

            var btHead = new SadConsole.Controls.Button(5, 1)
            {
                Text     = " H ",
                Position = new Point(11, 2)
            };

            Add(btHead);

            var btLAL = new SadConsole.Controls.Button(5, 1)
            {
                Text     = "LAL",
                Position = new Point(3, 7)
            };

            Add(btLAL);

            var btRAL = new SadConsole.Controls.Button(5, 1)
            {
                Text     = "RAL",
                Position = new Point(19, 7)
            };

            Add(btRAL);

            var btDD = new SadConsole.Controls.Button(5, 1)
            {
                Text     = " D ",
                Position = new Point(11, 8)
            };

            Add(btDD);

            var btLH = new SadConsole.Controls.Button(4, 1)
            {
                Text     = "LH",
                Position = new Point(2, 9)
            };

            Add(btLH);

            var btRH = new SadConsole.Controls.Button(4, 1)
            {
                Text     = "RH",
                Position = new Point(21, 9)
            };

            Add(btRH);

            var btLLL = new SadConsole.Controls.Button(5, 1)
            {
                Text     = "LLL",
                Position = new Point(5, 14)
            };

            Add(btLLL);

            var btRLL = new SadConsole.Controls.Button(5, 1)
            {
                Text     = "RLL",
                Position = new Point(16, 14)
            };

            Add(btRLL);

            var btLF = new SadConsole.Controls.Button(4, 1)
            {
                Text     = "LF",
                Position = new Point(3, 17)
            };

            Add(btLF);

            var btRF = new SadConsole.Controls.Button(4, 1)
            {
                Text     = "RF",
                Position = new Point(19, 17)
            };

            Add(btRF);

            SadConsole.Controls.ProgressBar health = new SadConsole.Controls.ProgressBar(2, 10, System.Windows.VerticalAlignment.Top);
            health.Position = new Point(27, 0);
            health.SetForeground(0, 9, Color.Green);
            Add(health);

            borderSurface = new SadConsole.Surfaces.BasicSurface(Width + 2, Height + 2, base.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.Draw(editor);
            base.Renderer.Render(borderSurface);
        }
Beispiel #12
0
        private static void Init()
        {
            var colors = SadConsole.Themes.Library.Default.Colors.Clone();

            colors.Appearance_ControlNormal    = new Cell(Color.White, Color.Black);
            colors.Appearance_ControlFocused   = new Cell(Color.White, Color.Gray);
            colors.Appearance_ControlMouseDown = new Cell(Color.White, Color.DarkGray);
            colors.Appearance_ControlOver      = new Cell(Color.White, Color.Gray);
            colors.Appearance_ControlSelected  = new Cell(Color.White, Color.Gray);
            colors.TextLight       = Color.White;
            colors.ControlBack     = Color.Black;
            colors.ControlHostBack = Color.Black;
            colors.Text            = Color.White;
            colors.TitleText       = Color.White;

            SadConsole.Themes.Library.Default.Colors      = colors;
            SadConsole.Themes.Library.Default.ButtonTheme = new SadConsole.Themes.ButtonLinesTheme
            {
                EndCharacterLeft  = '|',
                EndCharacterRight = '|'
            };

            var console = new SadConsole.ControlsConsole(Settings.Width, Settings.Height)
            {
                DefaultBackground = Color.Black,
                DefaultForeground = Color.White
            };

            console.PrintCentre(Settings.Width / 2, 1, "Main  Screen");

            console.Add(new NavigateButton <GameScreen>(16, 3)
            {
                Text     = "Play",
                Position = new Point(Settings.Width / 2 - 8, 6)
            });

            console.Add(new NavigateButton <OptionsScreen>(16, 3)
            {
                Text     = "Options",
                Position = new Point(Settings.Width / 2 - 8, 10)
            });

            console.Add(new NavigateButton <InfoScreen>(16, 3)
            {
                Text     = "Information",
                Position = new Point(Settings.Width / 2 - 8, 14)
            });

            var exit = new SadConsole.Controls.Button(16, 3)
            {
                Text     = "Exit Game",
                Position = new Point(Settings.Width / 2 - 8, Settings.Height - 8)
            };

            exit.Click += (a, b) =>
            {
                Environment.Exit(0);
            };
            console.Add(exit);

            console.IsFocused = true;
            SadConsole.Global.CurrentScreen = console;

            GameScreen.PrintLine($"\nNeed some help? You can type <{Color.Cyan.ToInteger()},help>Help@ at any time to see all the commands you can use.");
            GameScreen.Print($" You can also enable <{Color.Orange.ToInteger()},>[info]@ messages and debug commands by enabling debug mode in the options menu.");
            GameScreen.PrintLine($"\nWhen you see a link <{Color.Cyan.ToInteger()},say you pressed a link!>like this@ you can click on it to quickly interact with objects or repeat commands.");
        }
Beispiel #13
0
        private void InitHealthAndStamina()
        {
            health.BorderAppearance = new Cell(Resources.Palette.Mandy, Resources.Palette.Mandy);
            health.Center           = new Point(7, 8);
            health.Radius           = 4;

            stamina.BorderAppearance = new Cell(Resources.Palette.RoyalBlue, Resources.Palette.RoyalBlue);
            stamina.Center           = new Point(51, 8);
            stamina.Radius           = 4;

            int column1 = 22;
            int column2 = 26;
            int column3 = 30;
            int column4 = 34;
            int row1    = 2;
            int row2    = 6;
            int row3    = 10;

            var button1 = new SadConsole.Controls.Button(3, 3);

            button1.Text     = "1";
            button1.Position = new Point(column1, row1);
            Add(button1);

            var button2 = new SadConsole.Controls.Button(3, 3);

            button2.Text     = "2";
            button2.Position = new Point(column2, row1);
            Add(button2);

            var button3 = new SadConsole.Controls.Button(3, 3);

            button3.Text     = "3";
            button3.Position = new Point(column3, row1);
            Add(button3);

            var button4 = new SadConsole.Controls.Button(3, 3);

            button4.Text     = "4";
            button4.Position = new Point(column4, row1);
            Add(button4);

            var buttonQ = new SadConsole.Controls.Button(3, 3);

            buttonQ.Text     = "Q";
            buttonQ.Position = new Point(column1, row2);
            Add(buttonQ);

            var buttonW = new SadConsole.Controls.Button(3, 3);

            buttonW.Text     = "W";
            buttonW.Position = new Point(column2, row2);
            Add(buttonW);

            var buttonE = new SadConsole.Controls.Button(3, 3);

            buttonE.Text     = "E";
            buttonE.Position = new Point(column3, row2);
            Add(buttonE);

            var buttonR = new SadConsole.Controls.Button(3, 3);

            buttonR.Text     = "R";
            buttonR.Position = new Point(column4, row2);
            Add(buttonR);

            var buttonA = new SadConsole.Controls.Button(3, 3);

            buttonA.Text     = "A";
            buttonA.Position = new Point(column1, row3);
            Add(buttonA);

            var buttonS = new SadConsole.Controls.Button(3, 3);

            buttonS.Text     = "S";
            buttonS.Position = new Point(column2, row3);
            Add(buttonS);

            var buttonD = new SadConsole.Controls.Button(3, 3);

            buttonD.Text     = "D";
            buttonD.Position = new Point(column3, row3);
            Add(buttonD);

            var buttonF = new SadConsole.Controls.Button(3, 3);

            buttonF.Text     = "F";
            buttonF.Position = new Point(column4, row3);
            Add(buttonF);

            var buttonInv = new SadConsole.Controls.Button(3, 3);

            buttonInv.Text     = "I";
            buttonInv.Position = new Point(column1 - 5, row2 - 2);
            Add(buttonInv);

            var buttonSkills = new SadConsole.Controls.Button(3, 3);

            buttonSkills.Text     = "K";
            buttonSkills.Position = new Point(column4 + 5, row2 - 2);
            Add(buttonSkills);

            var buttonMain = new SadConsole.Controls.Button(5, 5);

            buttonMain.Text     = "L-M";
            buttonMain.Position = new Point(column1 - 7, row3 - 2);
            Add(buttonMain);

            var buttonOffhand = new SadConsole.Controls.Button(5, 5);

            buttonOffhand.Text     = "R-M";
            buttonOffhand.Position = new Point(column4 + 5, row3 - 2);
            Add(buttonOffhand);

            foreach (SadConsole.Controls.Button button in Controls)
            {
                button.Theme = GetButtonTheme();
            }
        }
Beispiel #14
0
        public ControlsTest()
            : base(80, 25)
        {
            IsVisible = false;

            var button1 = new SadConsole.Controls.Button(11);
            button1.Text = "Click";
            button1.Position = new Point(1, 3);
            button1.Click += (s, e) => Window.Message("Clicked!", "OK");
            Add(button1);

            var radioButton = new SadConsole.Controls.RadioButton(20, 1);
            radioButton.Text = "Group 1 Option 1";
            radioButton.Position = new Point(1, 5);
            Add(radioButton);

            radioButton = new SadConsole.Controls.RadioButton(20, 1);
            radioButton.Text = "Group 1 Option 2";
            radioButton.Position = new Point(1, 7);
            Add(radioButton);

            radioButton = new SadConsole.Controls.RadioButton(20, 1);
            radioButton.Text = "Group 2 Option 1";
            radioButton.Position = new Point(1, 9);
            radioButton.GroupName = "group2";
            Add(radioButton);

            radioButton = new SadConsole.Controls.RadioButton(20, 1);
            radioButton.Text = "Group 2 Option 2";
            radioButton.Position = new Point(1, 11);
            radioButton.GroupName = "group2";
            Add(radioButton);

            var checkbox = new SadConsole.Controls.CheckBox(13, 1);
            checkbox.Text = "Check box";
            checkbox.Position = new Point(1, 13);
            Add(checkbox);

            var listbox = new SadConsole.Controls.ListBox(20, 6);
            listbox.Position = new Point(25, 3);
            listbox.HideBorder = false;
            listbox.Items.Add("item 1");
            listbox.Items.Add("item 2");
            listbox.Items.Add("item 3");
            listbox.Items.Add("item 4");
            listbox.Items.Add("item 5");
            listbox.Items.Add("item 6");
            listbox.Items.Add("item 7");
            listbox.Items.Add("item 8");
            Add(listbox);

            var slider = SadConsole.Controls.ScrollBar.Create(System.Windows.Controls.Orientation.Horizontal, 20);
            slider.Position = new Point(25, 10);
            slider.Maximum = 18;
            Add(slider);

            slider = SadConsole.Controls.ScrollBar.Create(System.Windows.Controls.Orientation.Vertical, 8);
            slider.Position = new Point(47, 3);
            slider.Maximum = 6;
            Add(slider);

            var input = new SadConsole.Controls.InputBox(20);
            input.Position = new Point(25, 12);
            Add(input);

            var selButton = new SadConsole.Controls.SelectionButton(20);
            selButton.Text = "Selection Button 1";
            selButton.Position = new Point(55, 3);
            Add(selButton);

            var selButton1 = new SadConsole.Controls.SelectionButton(20);
            selButton1.Text = "Selection Button 2";
            selButton1.Position = new Point(55, 4);
            Add(selButton1);

            var selButton2 = new SadConsole.Controls.SelectionButton(20);
            selButton2.Text = "Selection Button 3";
            selButton2.Position = new Point(55, 5);
            Add(selButton2);

            var selButton3 = new SadConsole.Controls.SelectionButton(20);
            selButton3.Text = "Selection Button 4";
            selButton3.Position = new Point(55, 6);
            Add(selButton3);

            var selButton4 = new SadConsole.Controls.SelectionButton(20);
            selButton4.Text = "Selection Button 5";
            selButton4.Position = new Point(55, 7);
            Add(selButton4);

            selButton.PreviousSelection = selButton4;
            selButton.NextSelection = selButton1;
            selButton1.PreviousSelection = selButton;
            selButton1.NextSelection = selButton2;
            selButton2.PreviousSelection = selButton1;
            selButton2.NextSelection = selButton3;
            selButton3.PreviousSelection = selButton2;
            selButton3.NextSelection = selButton4;
            selButton4.PreviousSelection = selButton3;
            selButton4.NextSelection = selButton;

            FocusedControl = null;
            //DisableControlFocusing = true;

            List<Tuple<Color, string>> colors = new List<Tuple<Color, string>>();
            colors.Add(new Tuple<Color, string>(StarterProject.Theme.Red, "Red"));
            colors.Add(new Tuple<Color, string>(StarterProject.Theme.RedDark, "DRed"));
            colors.Add(new Tuple<Color, string>(StarterProject.Theme.Purple, "Prp"));
            colors.Add(new Tuple<Color, string>(StarterProject.Theme.PurpleDark, "DPrp"));
            colors.Add(new Tuple<Color, string>(StarterProject.Theme.Blue, "Blu"));
            colors.Add(new Tuple<Color, string>(StarterProject.Theme.BlueDark, "DBlu"));
            colors.Add(new Tuple<Color, string>(StarterProject.Theme.Cyan, "Cya"));
            colors.Add(new Tuple<Color, string>(StarterProject.Theme.CyanDark, "DCya"));
            colors.Add(new Tuple<Color, string>(StarterProject.Theme.Green, "Gre"));
            colors.Add(new Tuple<Color, string>(StarterProject.Theme.GreenDark, "DGre"));
            colors.Add(new Tuple<Color, string>(StarterProject.Theme.Yellow, "Yel"));
            colors.Add(new Tuple<Color, string>(StarterProject.Theme.YellowDark, "DYel"));
            colors.Add(new Tuple<Color, string>(StarterProject.Theme.Orange, "Ora"));
            colors.Add(new Tuple<Color, string>(StarterProject.Theme.OrangeDark, "DOra"));
            colors.Add(new Tuple<Color, string>(StarterProject.Theme.Brown, "Bro"));
            colors.Add(new Tuple<Color, string>(StarterProject.Theme.BrownDark, "DBrow"));
            colors.Add(new Tuple<Color, string>(StarterProject.Theme.Gray, "Gray"));
            colors.Add(new Tuple<Color, string>(StarterProject.Theme.GrayDark, "DGray"));
            colors.Add(new Tuple<Color, string>(StarterProject.Theme.White, "White"));
            colors.Add(new Tuple<Color, string>(StarterProject.Theme.Black, "Black"));

            backgroundcycle = colors.Select(i => i.Item1).ToArray();
            backIndex = 5;

            //int y = 25 - 20;
            //int x = 0;
            //int colorLength = 4;
            //foreach (var color1 in colors)
            //{
            //    foreach (var color2 in colors)
            //    {
            //        _Print(x, y, new ColoredString(color2.Item2.PadRight(colorLength).Substring(0, colorLength), color2.Item1, color1.Item1, null));
            //        y++;
            //    }

            //    y = 25 -20;
            //    x += colorLength;
            //}
        }