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 override Value Invoke( List Arguments ) { Shape = new ColoredShape(); Firefly.AddToRenderList( Shape ); FilledPoly = new Array(); OutlinePoly = new Array(); Identifiers[ "FilledPolygons" ] = new Reference( FilledPoly ); Identifiers[ "OutlinePolygons" ] = new Reference( OutlinePoly ); Identifiers[ "SetPolygons" ] = new Reference( new ExternalFunction( "SetPolygons", false, SetPolygons ) ); Identifiers[ "X" ] = new Reference( new ExternalProperty( "X", false, XChange, () => new Number( Shape.X ) ) ); Identifiers[ "Y" ] = new Reference( new ExternalProperty( "Y", false, YChange, () => new Number( Shape.Y ) ) ); Identifiers[ "Rotation" ] = new Reference( new ExternalProperty( "Rotation", false, X => Shape.Rotation = (float)( (Number)X ).Val, () => new Number( Shape.Rotation ) ) ); return this; }
static void OnLoad( object Target, EventArgs Arguments ) { Firefly.Window.ClearColor = System.Drawing.Color.Black; ColoredShape background = new ColoredShape(); background.FilledPolygons.AddLast( new Polygon( false, 0, 0, 0.5F, 0.5F, 0.5F, 1, 800, 0, 0.5F, 0.5F, 0.5F, 1, 800, 500, 0.5F, 0.5F, 0.5F, 1, 0, 500, 0.5F, 0.5F, 0.5F, 1 ) ); background.SetPolygons(); //Firefly.RenderList.AddLast( background ); new Mouse(); }
public TextField(Font font, Brush textColor, uint backgroundColor, float width, float height, Rectangle? wordWrap = null) { layer = new Layer(); AddChild(layer); float a = (backgroundColor & 0xFF) / 255F; float b = ((backgroundColor >> 8) & 0xFF) / 255F; float g = ((backgroundColor >> 16) & 0xFF) / 255F; float r = ((backgroundColor >> 24) & 0xFF) / 255F; background = new ColoredRectangle(0, 0, width, height, r, g, b, a); layer.AddChild(background); layer.StencilMasks.AddLast(background); text = new Label("", font, textColor, wordWrap, LabelSizeMethod.SmallestPossible); layer.AddChild(text); InteractsWithMouse = true; arrow = new ColoredShape(); arrow.FilledPolygons.AddLast(new Polygon(false, 0, 5, 1, 1, 1, 1, 5, 0, 1, 1, 1, 1, 5, 10, 1, 1, 1, 1)); arrow.FilledPolygons.AddLast(new Polygon(false, 5, 3, 1, 1, 1, 1, 5, 7, 1, 1, 1, 1, 10, 7, 1, 1, 1, 1, 10, 3, 1, 1, 1, 1)); arrow.SetPolygons(); arrow.Visible = false; AddChild(arrow); CursorPosition = 0; OnChange += OnChangeHandler; IllegalChars = new List<char>(); IllegalChars.Add('\b'); }
protected override DisplayObject CloneSelf() { Shape clone = null; if (this is ColoredShape) { clone = new ColoredShape(); } else { clone = new TexturedShape(); } foreach (var poly in filledPolygons) clone.filledPolygons.AddLast(poly); foreach (var poly in outlinePolygons) clone.outlinePolygons.AddLast(poly); clone.SetPolygons(); 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; }
private void MakeChargeMarker() { originalChargeMarker = new ColoredShape(); originalChargeMarker.FilledPolygons.AppendMany( new Polygon(false, 0, 0, 1, 1, 1, 0.7F, SIZE, 0, 1, 1, 1, 0.7F, SIZE - 5, 5, 1, 1, 1, 0, 5, 5, 1, 1, 1, 0), new Polygon(false, SIZE, 0, 1, 1, 1, 0.7F, SIZE, SIZE, 1, 1, 1, 0.7F, SIZE - 5, SIZE - 5, 1, 1, 1, 0, SIZE - 5, 5, 1, 1, 1, 0), new Polygon(false, SIZE, SIZE, 1, 1, 1, 0.7F, 0, SIZE, 1, 1, 1, 0.7F, 5, SIZE - 5, 1, 1, 1, 0, SIZE - 5, SIZE - 5, 1, 1, 1, 0), new Polygon(false, 0, SIZE, 1, 1, 1, 0.7F, 0, 0, 1, 1, 1, 0.7F, 5, 5, 1, 1, 1, 0, 5, SIZE - 5, 1, 1, 1, 0)); originalChargeMarker.SetPolygons(); }