Files
prog2/Game/Animations/Animation.h
Bram Verhulst 5f1dcd5788 Add Alot
2024-06-09 22:03:29 +02:00

41 lines
769 B
C++

#pragma once
#include "Texture.h"
class Animation
{
public:
Animation(Texture* pTexture, int frames, float frameDuration, Rectf srcRect, bool isLooping = true);
~Animation() = default;
void Update(float elapsedSec);
void Draw(const Vector2f& pos) const;
void Draw(const Vector2f& pos, const Rectf& dst) const;
void SetPlaying(bool isPlaying);
void SetFlipped(bool isFlipped);
void Reset();
bool IsDone() const;
int GetFrameCount() const;
void SetFrame(int frame);
private:
Texture* m_pTexture;
Rectf m_SrcRect;
int m_Frames { 0 };
int m_CurrentFrame { 0 };
float m_FrameTimer { 0.0f };
float m_FrameDuration { 0.1f };
bool m_IsPlaying { true };
bool m_IsFlipped { false };
bool m_IsLooping { true };
bool m_HasPlayedOnce { false };
};