示例#1
0
        public ConsoleForm(Control parent = null)
            : base(new Rectangle(0, 0, GraphicsManager.Instance.Viewport.Width, Math.Min(500, GraphicsManager.Instance.Viewport.Height)), parent)
        {
            Text               = $"{ENGINE_NAME} - {Engine.Instance.Version}".ToRichText();
            Draggable          = false;
            Visible            = false;
            DrawTitlebar       = false;
            CloseButtonEnabled = false;
            HotKey             = '`';
            if (parent != null && parent as Canvas != null)
            {
                (parent as Canvas).AlwayOnTop = this;
            }

            Font = Engine.Instance.Content.GetAsset <Font>(ASSET_FONT_CONSOLE);

            int commandBoxHeight = 30;

            commandBox               = new TextBox(new Rectangle(0, Bounds.Height - commandBoxHeight, Bounds.Width, commandBoxHeight), this);
            commandBox.Font          = Font;
            commandBox.EnterPressed += CommandBox_EnterPressed;

            messageLog      = new TextLog(new Rectangle(0, 0, Bounds.Width, Bounds.Height - commandBox.Bounds.Height), this);
            messageLog.Font = Font;
            foreach (string line in ConsoleManager.Instance.Lines.ToArray())
            {
                messageLog.WriteLine(new RichText(line, Color, Font));
            }
            messageLog.WriteLine(new RichText(new RichTextSection("---- End of backlog ----", Color.Red)));

            EventInput.KeyUp += EventInput_KeyUp;
            VisibleChanged   += Form_VisibleChanged;
            ConsoleManager.Instance.LineWritten += ConsoleManager_LineWritten;
            ConsoleManager.Instance.ClearLines  += ConsoleManager_ClearLines;
        }
示例#2
0
 public TextLogConfig(TextLog textLog)
     : base(textLog)
 {
     LinesToDraw = textLog.LinesToDraw;
     LinesToKeep = textLog.LinesToKeep;
     LineSpacing = textLog.LineSpacing;
 }