public DebugConsole() { ExposedReferences = new Dictionary<string, object>(); visuals = new DisplayObject(); AddChild(visuals); var background = new ColoredRectangle(0, 0, Firefly.Window.Width, Firefly.Window.Height / 2, 0, 0, 0, 0.85F); visuals.AddChild(background); var line = new ColoredShape(); line.OutlinePolygons.AddLast(new Polygon(false, 4, 0, 1, 1, 1, 1, Firefly.Window.Width - 4, 0, 1, 1, 1, 1)); line.SetPolygons(); line.Y = Firefly.Window.Height / 2 - 20; visuals.AddChild(line); input = new TextField(new System.Drawing.Font("Consolas", 10), System.Drawing.Brushes.White, 0x0, Firefly.Window.Width, 20); input.Y = Firefly.Window.Height / 2 - 17; input.IllegalChars.AppendMany('\r', '\n'); visuals.AddChild(input); consoleText = new Label("", new Font("Consolas", 10), Brushes.White); visuals.AddChild(consoleText); history = new List<string>(); CloseConsole(); }
private void OnChangeHandler(TextField field, string str) { if (lastText == "" && str != "") CursorPosition = str.Length; else CursorPosition = CursorPosition; //To check if the cursor is out of bounds }