public override void Draw(CanvasContext2D context) { context.FillStyle = "red"; context.FillRect(100, 100, 200, 200); context.DrawImage(someImage, 250, 250); context.DrawImage(someImage, 350, 350, 100, 100, 200, 200, 100, 100); for (int i = 0; i < DebugText.Length; i++) { if (DebugText[i].Truthy()) { context.Save(); context.StrokeStyle = "white"; context.StrokeText(DebugText[i].ToString(), Screen.Width - 120, i * 20 + 150); context.Restore(); } } }
public override void Draw(CanvasContext2D context) { foreach (var kingdom in Kingdoms) { foreach (var tower in kingdom.Value.Towers) { tower.Drawer.Draw(context, tower.X * Scale.X, tower.Y * Scale.Y); } foreach (var unit in kingdom.Value.Units) { unit.Draw(context, unit.X * Scale.X, unit.Y * Scale.Y); } } foreach (var waypointMap in WaypointMaps) { waypointMap.Drawer.Draw(context, 0, 0); } for (int i = 0; i < DebugText.Length; i++) { if (DebugText[i].Truthy()) { context.Save(); context.StrokeStyle = "white"; context.StrokeText(DebugText[i].ToString(), Screen.Width - 120, i * 20 + 150); context.Restore(); } } }