public async ValueTask Draw(CanvasWrapper ds) { await ds.SetGlobalAlphaAsync(.5f); await ds.FillRect(0, 0, 200, 100, Color.DarkSlateGray); await ds.DrawText($"FPS:{DiagInfo.Fps}", Point.Empty, Color.White); await ds.DrawText($"Tot time:{DiagInfo.TotalTime:c}", new(50, 00), Color.White); await ds.DrawText($"Draw count:{DiagInfo.DrawCount:D}", new(0, 15), Color.White); await ds.DrawText( $"Update count:{DiagInfo.UpdateCount:D} ({DiagInfo.UpdateCount - DiagInfo.DrawCount:D} more)", new(0, 30), Color.White); await ds.DrawText($"Elapsed:{DiagInfo.Elapsed:g}", new(0, 45), Color.White); await ds.DrawText($"loop tm taken:{DiagInfo.GameLoopDurationMs:D}", new(0, 60), Color.White); await ds.DrawText($"max loop tm taken:{DiagInfo.MaxGameLoopDurationMs:D}", new(0, 65), Color.White); await ds.DrawText($"slow frames:{DiagInfo.SlowElapsedCount:D}", new(0, 80), Color.White); await ds.SetGlobalAlphaAsync(1f); }
public async ValueTask Draw(CanvasWrapper session) { await _powerPillToEat.Draw(session); if (_legendVisible) { await _powerPillLegend.Draw(session); await _pillLegend.Draw(session); await session.DrawMyText("10 pts", new Vector2(80, 170), Colors.White); await session.DrawMyText("50 pts", new Vector2(80, 180), Colors.White); } if (_copyrightVisible) { await session.DrawMyText("© 1980 midway mfg. co.", new Vector2(10, 220), Colors.White); } await _tempSprites.Draw(session); foreach (var eachGhost in _ghosts) { if (eachGhost.Alive) { await eachGhost.Draw(session); } } await _pacMan.Draw(session); var gp = _ghosts[0].Position; await session.DrawText("STEVE DUNN 2020", new Point((int)gp.X + 2, (int)(gp.Y + 22)), Color.Black); await session.DrawText("STEVE DUNN 2020", new Point((int)gp.X, (int)(gp.Y + 20)), Color.Yellow); }
public static async ValueTask DrawMyText(this CanvasWrapper session, string text, Vector2 pos, Color color) { await session.DrawText(text, pos.toPoint(), color, _canvasTextFormat); }