#pragma once #include #include #include #include #include class DGifPlayer { public: DGifPlayer() { last = std::chrono::high_resolution_clock::now(); } bool Load(const std::string& path); void Update(float deltaTime); void Destroy(); float TimeDelta() { auto now = std::chrono::high_resolution_clock::now(); std::chrono::duration diff = now - last; last = now; return diff.count(); // seconds } GLuint GetTexture() const { return texture; } private: GLuint texture = 0; int width = 0; int height = 0; std::vector frames; std::vector delays; float timer = 0.0f; int currentFrame = 0; std::chrono::high_resolution_clock::time_point last; }; extern DGifPlayer gif_player;