1 using Microsoft.Xna.Framework;
8 private static double alpha;
13 public static double TotalTime;
17 public static double TotalTimeUnpaused;
19 public static double Accumulator;
20 public const int FixedUpdateRate = 60;
21 public const double Step = 1.0 / FixedUpdateRate;
22 public static double AccumulatorMax = 0.25f;
27 public static int FrameLimit => GameSettings.CurrentConfig.Graphics.FrameLimit;
29 public static double Alpha
32 set { alpha = Math.Min(Math.Max(value, 0.0), 1.0); }
35 public static double Interpolate(
double previous,
double current)
37 return current * alpha + previous * (1.0 - alpha);
40 public static float Interpolate(
float previous,
float current)
42 return current * (float)alpha + previous * (1.0f - (
float)alpha);
45 public static float InterpolateRotation(
float previous,
float current)
48 if (MathUtils.NearlyEqual(previous, current, epsilon: 0.02f)) {
return current; }
49 float angleDiff = MathUtils.GetShortestAngle(previous, current);
50 return previous + angleDiff * (float)alpha;
53 public static Vector2 Interpolate(Vector2 previous, Vector2 current)
56 Interpolate(previous.X, current.X),
57 Interpolate(previous.Y, current.Y));