public CharacterViewer() : base(27, 20) { //DefaultShowLocation = StartupLocation.CenterScreen; //Fill(Color.White, Color.Black, 0, null); Title = (char)198 + "Character" + (char)198; TitleAlignment = System.Windows.HorizontalAlignment.Left; //SetTitle(" Characters ", System.Windows.HorizontalAlignment.Center, Color.Blue, Color.LightGray); CloseOnESC = true; // CHARACTER SCROLL _charScrollBar = ScrollBar.Create(System.Windows.Controls.Orientation.Vertical, 16); _charScrollBar.Position = new Point(17, 1); _charScrollBar.Name = "ScrollBar"; _charScrollBar.Maximum = textSurface.Font.Rows - 16; _charScrollBar.Value = 0; _charScrollBar.ValueChanged += new EventHandler(_charScrollBar_ValueChanged); _charScrollBar.IsEnabled = textSurface.Font.Rows > 16; // Effects effects = new EffectsManager(textSurface); // Add all controls this.Add(_charScrollBar); _closeButton = new Button(6) { Text = "Ok", Position = new Point(19, 1) }; Add(_closeButton); _closeButton.Click += (sender, e) => { DialogResult = true; Hide(); }; _highlightedCellEffect.Foreground = Color.Blue; _highlightedCellEffect.Background = ColorHelper.DarkGray; // The frame will have been drawn by the base class, so redraw and our close button will be put on top of it Redraw(); }
public CharacterViewer() : base(27, 20) { //DefaultShowLocation = StartupLocation.CenterScreen; //Fill(Color.White, Color.Black, 0, null); Title = (char)198 + "Character" + (char)198; TitleAlignment = HorizontalAlignment.Left; //SetTitle(" Characters ", HorizontalAlignment.Center, Color.Blue, Color.LightGray); CloseOnEscKey = true; UsePixelPositioning = true; // CHARACTER SCROLL _charScrollBar = new ScrollBar(Orientation.Vertical, 16) { Position = new Point(17, 1), Name = "ScrollBar", Maximum = Font.Rows - 16, Value = 0 }; _charScrollBar.ValueChanged += new EventHandler(_charScrollBar_ValueChanged); _charScrollBar.IsEnabled = Font.Rows > 16; // Add all controls Add(_charScrollBar); _closeButton = new Button(6, 1) { Text = "Ok", Position = new Point(19, 1) }; Add(_closeButton); _closeButton.Click += (sender, e) => { DialogResult = true; Hide(); }; // Effects highlightedEffect = new Recolor { Foreground = Color.Blue, Background = Color.DarkGray }; unhighlightEffect = new SadConsole.Effects.Fade() { FadeBackground = true, FadeForeground = true, DestinationForeground = new ColorGradient(highlightedEffect.Foreground, Color.White), DestinationBackground = new ColorGradient(highlightedEffect.Background, Color.Black), FadeDuration = 0.3d, RemoveOnFinished = true, UseCellBackground = false, UseCellForeground = false, CloneOnApply = true, Permanent = true }; Theme = SadConsole.Themes.Library.Default.WindowTheme.Clone(); Theme.BorderLineStyle = CellSurface.ConnectedLineThick; // The frame will have been drawn by the base class, so redraw and our close button will be put on top of it //Invalidate(); }
public CharacterViewer() : base(27, 20) { //DefaultShowLocation = StartupLocation.CenterScreen; //Fill(Color.White, Color.Black, 0, null); Title = (char)198 + "Character" + (char)198; TitleAlignment = System.Windows.HorizontalAlignment.Left; //SetTitle(" Characters ", System.Windows.HorizontalAlignment.Center, Color.Blue, Color.LightGray); CloseOnESC = true; UsePixelPositioning = true; // CHARACTER SCROLL _charScrollBar = ScrollBar.Create(System.Windows.Controls.Orientation.Vertical, 16); _charScrollBar.Position = new Point(17, 1); _charScrollBar.Name = "ScrollBar"; _charScrollBar.Maximum = textSurface.Font.Rows - 16; _charScrollBar.Value = 0; _charScrollBar.ValueChanged += new EventHandler(_charScrollBar_ValueChanged); _charScrollBar.IsEnabled = textSurface.Font.Rows > 16; // Add all controls this.Add(_charScrollBar); _closeButton = new Button(6) { Text = "Ok", Position = new Point(19, 1) }; Add(_closeButton); _closeButton.Click += (sender, e) => { DialogResult = true; Hide(); }; // Effects highlightedEffect = new Recolor(); highlightedEffect.Foreground = Color.Blue; highlightedEffect.Background = Color.DarkGray; unhighlightEffect = new SadConsole.Effects.Fade() { FadeBackground = true, FadeForeground = true, DestinationForeground = new ColorGradient(highlightedEffect.Foreground, Color.White), DestinationBackground = new ColorGradient(highlightedEffect.Background, Color.Black), FadeDuration = 0.3d, RemoveOnFinished = true, UseCellBackground = false, UseCellForeground = false, CloneOnApply = true, Permanent = true }; // The frame will have been drawn by the base class, so redraw and our close button will be put on top of it Redraw(); }
public CharacterViewer() : base(27, 20) { //DefaultShowLocation = StartupLocation.CenterScreen; //Fill(Color.White, Color.Black, 0, null); Title = (char)198 + "Character" + (char)198; TitleAlignment = System.Windows.HorizontalAlignment.Left; //SetTitle(" Characters ", System.Windows.HorizontalAlignment.Center, Color.Blue, Color.LightGray); CloseOnESC = true; // CHARACTER SCROLL _charScrollBar = new SadConsole.Controls.ScrollBar(System.Windows.Controls.Orientation.Vertical, 16) { Position = new Point(17, 1), Name = "ScrollBar", Maximum = this.Font.Rows - 16, Value = 0, }; _charScrollBar.ValueChanged += new EventHandler(_charScrollBar_ValueChanged); _charScrollBar.IsEnabled = this.Font.Rows > 16; // Add all controls this.Add(_charScrollBar); _closeButton = new Button(6, 1) { Text = "Ok", Position = new Point(19, 1) }; Add(_closeButton); _closeButton.ButtonClicked += (sender, e) => { DialogResult = true; Hide(); }; _highlightedCellEffect.Foreground = Color.Blue; _highlightedCellEffect.Background = Color.DarkGray; // The frame will have been drawn by the base class, so redraw and our close button will be put on top of it Redraw(); }
private void Generate() { DefaultBackground = Color.Black; DefaultForeground = Color.White; this.PrintCentre(Width / 2, 1, "Options"); this.PrintCentre(Width / 2, 4, "Game Size"); this.PrintCentre(Width / 2, 6, " "); this.PrintCentre(Width / 2, 6, "Width (" + Settings.gameSettings.width + ")"); Print(Width / 2 - 18, 7, Settings.MinWidth.ToString()); Print(Width / 2 + 16, 7, Settings.MaxWidth.ToString()); var widthScroll = new SadConsole.Controls.ScrollBar(Orientation.Horizontal, 30) { Position = new Point(Width / 2 - 15, 7) }; widthScroll.Maximum = Settings.MaxWidth - Settings.MinWidth; widthScroll.Step = 1; widthScroll.Value = Settings.Width - Settings.MinWidth; widthScroll.ValueChanged += WidthScroll_ValueChanged; Add(widthScroll); this.PrintCentre(Width / 2, 9, " "); this.PrintCentre(Width / 2, 9, "Height (" + Settings.gameSettings.height + ")"); Print(Width / 2 - 18, 10, Settings.MinHeight.ToString()); Print(Width / 2 + 16, 10, Settings.MaxHeight.ToString()); var heightScroll = new SadConsole.Controls.ScrollBar(Orientation.Horizontal, 30) { Position = new Point(Width / 2 - 15, 10) }; heightScroll.Maximum = Settings.MaxHeight - Settings.MinHeight; heightScroll.Step = 1; heightScroll.Value = Settings.Height - Settings.MinHeight; heightScroll.ValueChanged += HeightScroll_ValueChanged; Add(heightScroll); this.PrintCentre(Width / 2, 14, "Game Settings"); var debug = new SadConsole.Controls.CheckBox(15, 1) { Text = "Debug Mode", Position = new Point(Width / 2 - 7, 16) }; debug.IsSelected = Settings.DebugMode; debug.IsSelectedChanged += (a, b) => { Settings.DebugMode = ((a as SadConsole.Controls.CheckBox).IsSelected); Settings.gameSettings.debug = Settings.DebugMode; if (Settings.DebugMode) { GameScreen.PrintLine($"\nDebug mode enabled - You can simulate the bodyparts on yourself to test the blood and organs systems with the <{Color.Cyan.ToInteger()},debug simulate me>debug simulate me@ command."); GameScreen.Print($"You can also get a summary of all your bodyparts with the <{Color.Cyan.ToInteger()},debug look at me>debug look at me@ command."); } }; Add(debug); Add(new BackButton(30, 3) { Text = "Discard changes and return", Position = new Point(Width / 2 - 32, Settings.Height - 8) }); var backbutton = new SadConsole.Controls.Button(30, 3) { Text = "Save changes and return", Position = new Point(Width / 2 + 2, Settings.Height - 8) }; backbutton.Click += (a, b) => { Settings.SaveSettings(); GameWindow.NavigateBack(); }; Add(backbutton); if (Settings.gameSettings.width != Settings.Width || Settings.gameSettings.height != Settings.Height) { this.PrintCentre(Width / 2, 12, "Resolution changes will require a restart", new Cell(Color.OrangeRed, Color.Black)); } }
public CharacterViewer() : base(27, 20) { //DefaultShowLocation = StartupLocation.CenterScreen; //Fill(Color.White, Color.Black, 0, null); Title = (char)198 + "Character" + (char)198; TitleAlignment = HorizontalAlignment.Left; //SetTitle(" Characters ", HorizontalAlignment.Center, Color.Blue, Color.LightGray); CloseOnEscKey = true; UsePixelPositioning = true; // CHARACTER SCROLL _charScrollBar = new ScrollBar(Orientation.Vertical, 16) { Position = new Point(17, 1), Name = "ScrollBar", Maximum = Font.Rows - 16, Value = 0 }; _charScrollBar.ValueChanged += new EventHandler(_charScrollBar_ValueChanged); _charScrollBar.IsEnabled = Font.Rows > 16; // Add all controls Add(_charScrollBar); _closeButton = new Button(6, 1) { Text = "Ok", Position = new Point(19, 1) }; Add(_closeButton); _closeButton.Click += (sender, e) => { DialogResult = true; Hide(); }; // Effects highlightedEffect = new Recolor { Foreground = Color.Blue, Background = Color.DarkGray }; unhighlightEffect = new SadConsole.Effects.Fade() { FadeBackground = true, FadeForeground = true, DestinationForeground = new ColorGradient(highlightedEffect.Foreground, Color.White), DestinationBackground = new ColorGradient(highlightedEffect.Background, Color.Black), FadeDuration = 0.3d, RemoveOnFinished = true, UseCellBackground = false, UseCellForeground = false, CloneOnApply = true, Permanent = true }; Theme = SadConsole.Themes.Library.Default.WindowTheme.Clone(); Theme.BorderLineStyle = CellSurface.ConnectedLineThick; // The frame will have been drawn by the base class, so redraw and our close button will be put on top of it //Invalidate(); // Get the existing colors object var colors = SadConsole.Themes.Colors.CreateAnsi(); // Use a common background color var backgroundColor = Color.Black; // Assign the background color to both the hosts (console) and controls colors.ControlHostBack = backgroundColor; colors.ControlBack = backgroundColor; // Build other colors used by themes based on the background color colors.ControlBackLight = (backgroundColor * 1.3f).FillAlpha(); colors.ControlBackDark = (backgroundColor * 0.7f).FillAlpha(); // When a control is selected, a color indicates it. this is either some other color or a lighter color // the colors object also defines a palette of colors, we'll use this. colors.ControlBackSelected = colors.GrayDark; // Build the colors into theme objects for control appearance states colors.RebuildAppearances(); _characterSurface = new DrawingSurface(16, 16); _characterSurface.Position = new Point(1, 1); _characterSurface.OnDraw = (ds) => { ds.Surface.Effects.UpdateEffects(Global.GameTimeElapsedUpdate); if (hasDrawn) { return; } ds.Surface.Fill(Foreground, Background, 0); int charIndex = fontRowOffset * 16; for (int y = 0; y < 16; y++) { for (int x = 0; x < 16; x++) { ds.Surface.SetGlyph(x, y, charIndex); charIndex++; } } hasDrawn = true; }; _characterSurface.MouseMove += _characterSurface_MouseMove; _characterSurface.MouseButtonClicked += _characterSurface_MouseButtonClicked; _characterSurface.MouseExit += _characterSurface_MouseExit; Add(_characterSurface); ThemeColors = colors; IsDirty = true; }