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(); }
public void RemoveObjectAt(DisplayObject target) { for (int i = 0; i < columns; ++i) { for (int j = 0; j < rows; ++j) { if (table[i, j].Contains(target)) table[i, j].Remove(target); } } if (target is Label) { (target as Label).WordWrap = null; (target as Label).UpdateText(); } RemoveChild(target); }
public void AddObjectAt(int column, int row, DisplayObject target) { if (column >= columns || row >= rows) throw new Exception("Table not large enough"); table[column, row].AddLast(target); float x = 0; for (int i = 0; i < column; ++i) x += ColumnWidth[i]; float y = 0; for (int i = 0; i < row; ++i) y += RowHeight[i]; target.X = x; target.Y = y; if (target is Label) { var lbl = target as Label; lbl.WordWrap = new Rectangle(0, 0, ColumnWidth[column], RowHeight[row]); lbl.UpdateText(); } AddChild(target); }
protected virtual DisplayObject CloneSelf() { var clone = new DisplayObject(); clone.X = x; clone.Y = y; clone.Active = active; clone.Visible = visible; clone.ScaleX = scaleX; clone.ScaleY = scaleY; clone.Alpha = alpha; clone.IgnoresCamera = ignoresCamera; if (interactsWithMouse.HasValue) clone.InteractsWithMouse = interactsWithMouse.Value; clone.Rotation = rotation; return clone; }
public void RemoveChild(DisplayObject child) { children.Remove(child); child.Parent = null; child.UpdateProperties(); }
public void AddChild(DisplayObject child) { children.AddLast(child); child.Parent = this; child.UpdateProperties(); }
public Button(DisplayObject up, DisplayObject down, DisplayObject hover, float width, float height) { Skin = new ButtonSkin(up, down, hover); Initialize(width, height); }