コード例 #1
0
ファイル: MessageLog.cs プロジェクト: emcd123/Ascent
        // Create a new window with the title centered
        // the window is draggable by default
        public MessageLogWindow(int width, int height, string title) : base(width, height)
        {
            _lines  = new Queue <string>();
            CanDrag = true;
            Title   = title.Align(HorizontalAlignment.Left, Width);

            // add the message console, reposition, enable the viewport, and add it to the window
            _messageConsole = new SadConsole.ScrollingConsole(width - _windowBorderThickness, _maxLines);
            _messageConsole.Fill(Color.Black, Color.Black, 176);
            _messageConsole.Position = new Point(1, 1);
            _messageConsole.ViewPort = new Rectangle(0, 0, width - 1, height - _windowBorderThickness);

            // create a scrollbar and attach it to an event handler, then add it to the Window
            _messageScrollBar           = new SadConsole.Controls.ScrollBar(SadConsole.Orientation.Vertical, height - _windowBorderThickness);
            _messageScrollBar.Position  = new Point(_messageConsole.Width + 1, _messageConsole.Position.X);
            _messageScrollBar.IsEnabled = false;

            //_messageScrollBar.Theme.Colors.ControlHostFore = Color.White;
            _messageScrollBar.ValueChanged += MessageScrollBar_ValueChanged;
            Add(_messageScrollBar);

            // enable mouse input
            UseMouse = true;

            // Add the child consoles to the window
            Children.Add(_messageConsole);
        }
コード例 #2
0
        // Create a new window with the title centered
        // the window is draggable by default
        public MessageLogWindow(int width, int height, string title) : base(width, height)
        {
            // Ensure that the window background is the correct colour
            //    Theme.WindowTheme.FillStyle.Background = DefaultBackground;
            _lines  = new Queue <string>();
            CanDrag = true;
            Title   = title.Align(HorizontalAlignment.Center, Width);

            // add the message console, reposition, enable the viewport, and add it to the window
            _messageConsole          = new SadConsole.ScrollingConsole(width - _windowBorderThickness, _maxLines);
            _messageConsole.Position = new Point(1, 1);
            _messageConsole.ViewPort = new Rectangle(0, 0, width - 1, height - _windowBorderThickness);

            // create a scrollbar and attach it to an event handler, then add it to the Window
            _messageScrollBar               = new SadConsole.Controls.ScrollBar(SadConsole.Orientation.Vertical, height - _windowBorderThickness);
            _messageScrollBar.Position      = new Point(_messageConsole.Width + 1, _messageConsole.Position.X);
            _messageScrollBar.IsEnabled     = false;
            _messageScrollBar.ValueChanged += MessageScrollBar_ValueChanged;
            Add(_messageScrollBar);

            // enable mouse input
            UseMouse = true;

            // Add the child consoles to the window
            Children.Add(_messageConsole);
        }
コード例 #3
0
        public ViewsAndSubViews() : base(1, 1)
        {
            mainView = new ScrollingConsole(60, 23);
            subView  = ScrollingConsole.FromSurface(mainView.GetSubSurface(new Rectangle(0, 0, 20, 23)), Font);

            IsVisible = false;
            UseMouse  = true;

            mainView.DrawLine(new Point(59, 0), new Point(59, 22), Color.White, glyph: ConnectedLineThin[(int)ConnectedLineIndex.Left]);

            // Setup main view
            mainView.Position   = new Point(0, 0);
            mainView.MouseMove += (s, e) => { if (e.MouseState.Mouse.LeftButtonDown)
                                              {
                                                  e.MouseState.Cell.Background = Color.Blue; mainView.IsDirty = true;
                                              }
            };
            mainView.DirtyChanged += (s, e) => subView.IsDirty = true;

            // Setup sub view
            subView.Position = new Point(60, 0);
            //subView.SetViewFromSurface(new Rectangle(0, 0, 20, 23), mainView);
            subView.MouseMove += (s, e) => { if (e.MouseState.Mouse.LeftButtonDown)
                                             {
                                                 e.MouseState.Cell.Background = Color.Red; subView.IsDirty = true;
                                             }
            };
            subView.DirtyChanged += (s, e) => mainView.IsDirty = true;

            // Ad the consoles to the list.
            Children.Add(mainView);
            Children.Add(subView);
        }
コード例 #4
0
        public void CreateMapWindow(int width, int height, string title)
        {
            SadConsole.Themes.WindowTheme windowTheme = new SadConsole.Themes.WindowTheme();
            SadConsole.Themes.Library.Default.WindowTheme            = windowTheme;
            SadConsole.Themes.Library.Default.Colors.TitleText       = Color.White;
            SadConsole.Themes.Library.Default.Colors.Lines           = Color.Black;
            SadConsole.Themes.Library.Default.Colors.ControlHostBack = Color.Transparent;

            MapWindow = new Window(width, height, SadConsole.Global.FontEmbedded);
            var size = new Point(MapWindow.Width, MapWindow.Height).TranslateFont(MapWindow.Font, MapConsole.Font);

            MapWindow.CanDrag   = true;
            HealthBars          = new SadConsole.ScrollingConsole(80, height, SadConsole.Global.FontEmbedded);
            HealthBars.ViewPort = new Microsoft.Xna.Framework.Rectangle(width, 0, size.X * 2, size.Y);
            HealthBars.Position = new Point(width, 1);

            int mapConsoleWidth = width - 2;

            MapConsole.ViewPort = new Microsoft.Xna.Framework.Rectangle(0, 0, size.X, size.Y);
            MapConsole.Position = new Point(1, 1);

            MapWindow.Title = title.Align(HorizontalAlignment.Center, mapConsoleWidth);
            MapWindow.Children.Add(HealthBars);
            MapWindow.Children.Add(MapConsole);
            Children.Add(MapWindow);
            MapWindow.Show();
        }
コード例 #5
0
        public ChatLogWindow(int width, int height, string title) : base(width, height)
        {
            _lines  = new Queue <string>();
            CanDrag = true;
            Title   = title.Align(HorizontalAlignment.Center, Width, (char)205);

            _messageConsole          = new SadConsole.ScrollingConsole(width - _windowBorderThickness, _maxLines);
            _messageConsole.Position = new Point(1, 1);
            _messageConsole.ViewPort = new Rectangle(0, 0, width - 1, height - _windowBorderThickness - 3);

            _messageTextBox           = new SadConsole.Controls.TextBox(width - _windowBorderThickness - 3);
            _messageTextBox.Position  = new Point(_windowBorderThickness, height - _windowBorderThickness);
            _messageTextBox.IsEnabled = true;
            Add(_messageTextBox);

            _messageScrollBar               = new SadConsole.Controls.ScrollBar(SadConsole.Orientation.Vertical, height - _windowBorderThickness);
            _messageScrollBar.Position      = new Point(_messageConsole.Width + 1, _messageConsole.Position.X);
            _messageScrollBar.IsEnabled     = false;
            _messageScrollBar.ValueChanged += MessageScrollBar_ValueChanged;
            Add(_messageScrollBar);

            UseMouse = true;

            Children.Add(_messageConsole);
        }
コード例 #6
0
ファイル: UIManager.cs プロジェクト: firebellys/Roguelike
        // Loads a Map into the MapConsole
        private void LoadMap(Map map)
        {
            // First load the map's tiles into the console
            MapConsole = new SadConsole.ScrollingConsole(GameLoop.World.CurrentMap.Width, GameLoop.World.CurrentMap.Height, Global.FontDefault, new Rectangle(0, 0, GameLoop.GameWidth, GameLoop.GameHeight), map.Tiles);

            // Now Sync all of the map's entities
            SyncMapEntities(map);
        }
コード例 #7
0
        public RandomScrollingConsole() : base(80, 23)
        {
            messageData = new ScrollingConsole(80, 1);
            messageData.Print(0, 0, "Generating random console data, please wait...");
            mainData           = new ScrollingConsole(1, 1);
            IsVisible          = false;
            mainData.IsVisible = false;

            Children.Add(mainData);
            Children.Add(messageData);
        }
コード例 #8
0
        public MessageLogWindow(int width, int height, string title) : base(width, height)

        {
            Theme.FillStyle.Background = Color.Black;
            _lines  = new Queue <string>();
            CanDrag = true;
            Title   = title.Align(HorizontalAlignment.Center, Width);

            _messageConsole          = new SadConsole.ScrollingConsole(width - _windowBorderThickness, _maxLines, SadConsole.Global.FontEmbedded);
            _messageConsole.Position = new Point(1, 1);
            _messageConsole.ViewPort = new Rectangle(0, 0, width - 1, height - _windowBorderThickness);

            _messageScrollBar               = new SadConsole.Controls.ScrollBar(SadConsole.Orientation.Vertical, height - _windowBorderThickness);
            _messageScrollBar.Position      = new Point(_messageConsole.Width + 1, _messageConsole.Position.X);
            _messageScrollBar.IsEnabled     = false;
            _messageScrollBar.ValueChanged += MessageScrollBar_ValueChanged;
            _messageScrollBar.Position      = new Point(_messageConsole.Width, 1);

            Children.Add(_messageConsole);
        }
コード例 #9
0
 public void CreateConsoles()
 {
     MapConsole = new ScrollingConsole(GameLoop.GameWidth, GameLoop.GameHeight, normalSizedFont);
 }
コード例 #10
0
 private void LoadMap(Map map)
 {
     MapConsole = new SadConsole.ScrollingConsole(GameLoop.World.CurrentMap.Width, GameLoop.World.CurrentMap.Height, Global.FontDefault, new Microsoft.Xna.Framework.Rectangle(0, 0, GameLoop.GameWidth, GameLoop.GameHeight), map.Tiles);
     SyncMapEntities(map);
 }
コード例 #11
0
ファイル: UIManager.cs プロジェクト: firebellys/Roguelike
 // Creates all child consoles to be managed
 public void CreateConsoles()
 {
     // Temporarily create a console with *no* tile data that will later be replaced with map data
     MapConsole = new ScrollingConsole(GameLoop.GameWidth, GameLoop.GameHeight);
 }
コード例 #12
0
ファイル: UIManager.cs プロジェクト: hrogers2020/SadConsole
 // Creates all child consoles to be managed
 public void CreateConsoles()
 {
     MapConsole = new SadConsole.ScrollingConsole(Program.World.CurrentMap.Width, Program.World.CurrentMap.Height, Global.FontDefault, new Rectangle(0, 0, Program.GameWidth, Program.GameHeight), Program.World.CurrentMap.Tiles);
 }