Add linear interpolation of rendered entities

I've added a function Graphics::lerp() which simply interpolates between
two values given a certain alpha value. It's just like drawing a
straight line between two points.

Also, Graphics now has an `alpha` attribute, and it is set on every
deltatime update to be used in linear interpolation.
This commit is contained in:
Misa
2020-04-28 16:02:55 -07:00
committed by Ethan Lee
parent fd44098f38
commit 4f4d400ce0
3 changed files with 42 additions and 30 deletions

View File

@@ -288,6 +288,12 @@ public:
std::map<int, int> font_positions;
SDL_Surface* ghostbuffer;
float inline lerp(const float v0, const float v1)
{
return v0 + alpha * (v1 - v0);
}
float alpha;
};
extern Graphics graphics;