public override void Draw(SpriteBatch sb) { int linesX = (int)(bounds.Width / lineSpacing.X) + 1; int linesY = (int)(bounds.Height / lineSpacing.Y) + 1; Vector2 v1 = new Vector2(); Vector2 v2 = new Vector2(); v1.Y = bounds.Y; v2.Y = bounds.Y + bounds.Height; if (drawBackground) { sb.Draw(LineBatch._empty_texture, bounds, colour); } int v = Math.Abs(ticks % ticksToLerp - (ticksToLerp / 2)); Color c; float ll = (float)v / ((float)ticksToLerp / 2); if (ticksToLerp == 1) { c = lineColour1; } else { c = Color.Lerp(lineColour1, lineColour2, ll); } for (int x = 0; x < linesX; x++) { for (int i = 0; i < lineWidth; i++) { v1.X = offset.X + lineSpacing.X * x + bounds.X + i; v2.X = v1.X; if (v1.X < bounds.X + bounds.Width && drawVertical) { LineBatch.drawLine(sb, c, v1, v2); } } } v1.X = bounds.X; v2.X = bounds.X + bounds.Width; for (int y = 0; y < linesY; y++) { for (int i = 0; i < lineWidth; i++) { v1.Y = offset.Y + lineSpacing.Y * y + bounds.Y + i; v2.Y = v1.Y; if (v1.Y < bounds.Y + bounds.Height && drawHorizontal) { LineBatch.drawLine(sb, c, v1, v2); } } } }
void drawBullets(SpriteBatch sb) { for (int i = 0; i < shotsMax; i++) { if (bullets[i].X != 0) { for (int j = 0; j < shotWidth; j++) { LineBatch.drawLine(sb, shotColor, bullets[i] + new Vector2(j, 0), bullets[i] + new Vector2(j, shotLength)); } } } }
/// <summary> /// draw it so it helps /// </summary> /// <param name="sb"></param> /// <param name="cPoints"> color of points (or null if no points wanted)</param> /// <param name="cLines"> color of lines (or null if no lines wanted)</param> public void Draw(SpriteBatch sb, Color cPoints, Color cLines) { for (int i = 0; i < lst.Count(); i++) { WayPoint w = lst[i]; if (cPoints != null) { LineBatch.drawCrossX(sb, w.pos.X, w.pos.Y, 5, cPoints, cPoints); } if (cLines != null && i > 0) { WayPoint ww = lst[i - 1]; LineBatch.drawLine(sb, ww.pos.X, ww.pos.Y, w.pos.X, w.pos.Y, cLines); } } }