if its just for simple testing you can just use spritebatch to draw lines using regular old draw.
public static void DrawBasicLine(Vector2 s, Vector2 e, int thickness, Color linecolor)
spriteBatch.Draw(dot, new Rectangle((int)s.X, (int)s.Y, thickness, (int)Vector2.Distance(e, s)), new Rectangle(0, 0, 1, 1), linecolor, (float)Atan2Xna(e.X - s.X, e.Y - s.Y), Vector2.Zero, SpriteEffects.None, 0);
public static float Atan2Xna(float difx, float dify)
return (float)System.Math.Atan2(difx, dify) * -1f;
return (float)System.Math.Atan2(difx, dify);
A curve is just a series of lines if you need to draw a curve faster dynamically.
You’ll probably need to do so on a shader or something that’s a pretty complicated topic.
Statically you can use the line strategy and buffer the lines into a vertice buffer.
Varying the time below will give you points on the curve to use to form line segments.
You could put this onto a shader rendering a quad around the drawing area.
public Vector3 CalculateBspline(Vector4 a0, Vector4 a1, Vector4 a2, Vector4 a3, float time)
var a4 = (a1 - a0) * time + a0;
var a5 = (a2 - a1) * time + a1;
var a6 = (a3 - a2) * time + a2;
var a7 = (a5 - a4) * time + a4;
var a8 = (a6 - a5) * time + a5;
var a9 = (a8 - a7) * time + a7;
solved = a0;
solved = a1;
solved = a2;
solved = a3;
solved = a4;
solved = a5;
solved = a6;
solved = a7;
solved = a8;
solved = a9;
This is a incomplete sort of test project i started not sure were i was going with it really but game2 i believe will draw a simple subdivision bezier b-spline.