Example #1
0
        private static void Program_WindowResized(object?sender, EventArgs e)
        {
            var windowWidth  = Global.WindowWidth > 0 ? Global.WindowWidth : 1;
            var windowHeight = Global.WindowHeight > 0 ? Global.WindowHeight : 1;

            Global.CurrentScreen.Resize(
                windowWidth / Global.CurrentScreen.Font.Size.X,
                windowHeight / Global.CurrentScreen.Font.Size.Y,
                true);
            _uiConsole.Resize(
                windowWidth / Global.CurrentScreen.Font.Size.X,
                windowHeight / Global.CurrentScreen.Font.Size.Y,
                true);

            for (int y = 0; y < Global.CurrentScreen.Height; y++)
            {
                for (int x = 0; x < Global.CurrentScreen.Width; x++)
                {
                    var index = x + y * Global.CurrentScreen.Width;
                    if (index < Global.CurrentScreen.Font.MaxGlyphIndex)
                    {
                        Global.CurrentScreen.SetGlyph(x, y, index, Color.White, Color.Black, SpriteEffects.None);
                    }
                    if (index >= Global.CurrentScreen.Font.MaxGlyphIndex && index < _cheepicusFont.GetFont(Font.FontSizes.One).MaxGlyphIndex + Global.CurrentScreen.Font.MaxGlyphIndex)
                    {
                        _uiConsole.SetGlyph(x, y, index - Global.CurrentScreen.Font.MaxGlyphIndex, Color.Red, Color.Transparent, SpriteEffects.None);
                    }
                }
            }
        }
Example #2
0
        public static void UpdateSelectionBox(GoRogue.Rectangle box)
        {
            SelectionBox.Resize(box.Width, box.Height, true);
            SelectionBox.Position = box.Position;
            SelectionBox.DrawBox(new Microsoft.Xna.Framework.Rectangle(0, 0, SelectionBox.Width, SelectionBox.Height), new Cell(Color.White, Color.Transparent, 179));

            SelectionBox.ConnectLines();
        }
Example #3
0
 public void OnAdded(Console console)
 {
     _borderConsole = new Console(console.Width, console.Height, console.Font);
     _borderConsole.DrawBox(new Rectangle(0, 0, _borderConsole.Width, _borderConsole.Height),
                            _borderCellStyle, null, _borderGlyphs);
     _borderConsole.Position    = new Point(-1, -1);
     _borderConsole.UseMouse    = false;
     _borderConsole.UseKeyboard = false;
     console.Children.Add(_borderConsole);
     console.Resize(console.Width - 2, console.Height - 2, true);
     console.Position += new Point(1, 1);
 }
Example #4
0
        /// <inheritdoc />
        public override void Render(TimeSpan delta)
        {
            // These 3 render calls are a hack to get the console data generated and display a message to the user
            // Should add in async calls that let us generate these in the background... That would be cool.
            if (IsVisible)
            {
                if (!initialized)
                {
                    base.Render(delta);
                }
                else if (!initializedStep2)
                {
                    initializedStep2 = true;
                    base.Render(delta);
                }
                else if (!initializedStep3)
                {
                    base.Render(delta);

                    mainData.SadComponents.Clear();

                    // Generate the content
                    mainData.Resize(80, 23, 2000, 2000, false);
                    mainData.SadComponents.Add(new InputHandling.MoveViewPortKeyboardHandler());
                    mainData.FillWithRandomGarbage(Font);
                    mainData.IsVisible = true;

                    // Clear message data and make it transparent so that it acts as a layer
                    messageData.IsVisible = false;

                    // We need to set celldata to the big console data so we can use the FillWithRandom method.
                    initializedStep3 = true;
                }

                else
                {
                    // Set message data information about where the viewport is located
                    //messageData.Print(0, 0, $"{ViewArea.X} , {ViewArea.Y}            ", Color.White, Color.Black);

                    // Create a faux layering system.
                    base.Render(delta);

                    //Renderer.Render(messageData.TextSurface, new Point(0, 0));
                }
            }
        }
Example #5
0
 public void UpdateSize(Console console)
 {
     _borderConsole.Resize(console.Width + 2, console.Height + 2, true);
     _borderConsole.DrawBox(new Rectangle(0, 0, _borderConsole.Width, _borderConsole.Height), _borderCellStyle, null, _borderGlyphs);
 }