static void Main(string[] args) { //Drawers dw = new Drawers(); DrawDelegate dd = new DrawDelegate(Drawers.DrawTriangle); dd.Invoke(ConsoleColor.Red, 10, '*'); dd = Drawers.DrawSquare; dd.Invoke(ConsoleColor.Green, 10, '*'); //Drawers.DrawTriangle(ConsoleColor.Red, 10, '*'); //DrawSquare(ConsoleColor.Green, 5, '.'); Console.WriteLine("Hello World!"); dd += Drawers.DrawTriangle; dd.Invoke(ConsoleColor.Blue, 8, '-'); Console.WriteLine("Next Task:"); }
public void Draw() { var font = ImGui.GetFont(); if (Children.Count <= 0) { DrawDelegate?.Invoke(); if (Tooltip?.Length > 0) { ImGui.SameLine(); ImGui.TextDisabled("(?)"); if (ImGui.IsItemHovered(ImGuiHoveredFlags.None)) { ImGui.SetTooltip(Tooltip); } } return; } for (var i = 0; i < 5; i++) { ImGui.Spacing(); } ImGui.BeginGroup(); var contentRegionAvail = ImGui.GetContentRegionAvail(); var firstCursorPos = ImGui.GetCursorPos().Translate(10, font.FontSize * -0.66f); ImGui.BeginChild(Unique, new Vector2(contentRegionAvail.X, font.FontSize * 2 * (Children.Count + 0.2f)), true); foreach (var child in Children) { child.Draw(); } var secondCursorPos = ImGui.GetCursorPos().Translate(0, font.FontSize); ImGui.EndChild(); ImGui.SetCursorPos(firstCursorPos); ImGui.Text(Name); if (Tooltip?.Length > 0) { ImGui.SameLine(); ImGui.TextDisabled("(?)"); if (ImGui.IsItemHovered(ImGuiHoveredFlags.None)) { ImGui.SetTooltip(Tooltip); } } ImGui.SetCursorPos(secondCursorPos); ImGui.EndGroup(); DrawDelegate?.Invoke(); }
public void Draw() { _drawAction.Invoke(Pos, V, A, Color); if (!UseGravity) { return; } Pos = Pos + V * Dt; V = V + A * Dt; }
public void Draw() { _drawAction.Invoke(Pos, V, Vector2.Zero, Color); if (!UseGravity) { return; } var r = Pos.Length(); var a = -(GM / (float)Math.Pow(r, 3)) * Pos; //var a = f / _m; Pos = Pos + V * Dt; V = V + a * Dt; }
public virtual void Draw(GraphicsDeviceManager graphics, SpriteBatch spriteBatch, GameTime gameTime) { //Console.WriteLine("------------Start Drawing--------------"); foreach (SivForm sv in Form_list) { if (sv.Visible) { //Console.WriteLine("Drawing: " + sv.Name); sv.Draw(spriteBatch, gameTime); } } //Console.WriteLine("------------End Drawing--------------"); if (FormsDraw != null) { FormsDraw.Invoke(spriteBatch, gameTime); } }
public override bool PreDraw(int i, int j, SpriteBatch spriteBatch) { Tile tile = Main.tile[i, j]; if (ExtraDraw != null && tile.frameX == 0 && tile.frameY % Height == 0 && tile.frameY != 0) //only if there is a method to draw, and the tile is top left { spriteBatch.End(); spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.Additive, SamplerState.PointClamp, DepthStencilState.None, RasterizerState.CullNone, null, Main.GameViewMatrix.EffectMatrix); ExtraDraw.Invoke(i, j, spriteBatch); spriteBatch.End(); //reset to default spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.LinearClamp, DepthStencilState.None, RasterizerState.CullNone, null, Main.GameViewMatrix.EffectMatrix); } Helper.DrawGlowLayer(i, j, tile.frameX, tile.frameY % Height, TileTexture, Lighting.GetColor(i, j), spriteBatch); return(false); }
public void Draw() { var size = ImGui.GetFont(); if (Children.Count > 0) { for (var i = 0; i < 5; i++) { ImGui.Spacing(); } ImGui.BeginGroup(); var contentRegionAvail = ImGui.GetContentRegionAvail(); var OverChild = ImGui.GetCursorPos().Translate(10, size.FontSize * -0.66f); ImGui.BeginChild(Unique, new Vector2(contentRegionAvail.X, size.FontSize * 2 * (Children.Count + 0.2f)), true); foreach (var child in Children) { child.Draw(); } // var fontContainer = Fonts.Last().Value; // ImGui.PushFont(fontContainer.Atlas); var getCursor = ImGui.GetCursorPos().Translate(0, size.FontSize); ImGui.EndChild(); ImGui.SetCursorPos(OverChild); ImGui.Text(Name); if (Tooltip?.Length > 0) { ImGui.SameLine(); ImGui.TextDisabled("(?)"); if (ImGui.IsItemHovered(ImGuiHoveredFlags.None)) { ImGui.SetTooltip(Tooltip); } } ImGui.SetCursorPos(getCursor); ImGui.EndGroup(); DrawDelegate?.Invoke(); // ImGui.PopFont(); } else { DrawDelegate?.Invoke(); if (Tooltip?.Length > 0) { ImGui.SameLine(); ImGui.TextDisabled("(?)"); if (ImGui.IsItemHovered(ImGuiHoveredFlags.None)) { ImGui.SetTooltip(Tooltip); } } } }