For a school project we must make a pretty basic game in c#. So far we have created a gameloop and a basic draw function.
Our problem now is that the game randomly stutters. Sometimes it runs perfectly smooth when I run it, other times it stutters pretty bad.
Here is the gameloop:
And here is the paint method:
long currentMS = stopwatch.ElapsedMilliseconds;
while (stopwatch.ElapsedMilliseconds - currentMS < 16)
Does anyone have any idea what could cause the stutters?
protected override void OnPaint(PaintEventArgs e)
Graphics g = view.CreateGraphics();