mirror of
https://github.com/HowestDAE/dae16-VerhulstBram.git
synced 2025-12-17 01:11:47 +01:00
32 lines
605 B
C++
32 lines
605 B
C++
#pragma once
|
|
#include "Texture.h"
|
|
|
|
class Animation
|
|
{
|
|
public:
|
|
Animation(Texture* pTexture, int frames, float frameDuration, Rectf srcRect);
|
|
~Animation();
|
|
|
|
void Update(float elapsedSec);
|
|
void Draw(const Vector2f& pos) const;
|
|
void Draw(const Vector2f& pos, const Rectf& dst) const;
|
|
|
|
void SetPlaying(bool isPlaying) {
|
|
m_isPlaying = isPlaying;
|
|
}
|
|
void SetFlipped(bool isFlipped) {
|
|
m_isFlipped = isFlipped;
|
|
}
|
|
|
|
private:
|
|
Texture* m_pTexture;
|
|
Rectf m_SrcRect;
|
|
|
|
int m_Frames { 0 };
|
|
int m_CurrentFrame { 0 };
|
|
float m_FrameTimer { 0.0f };
|
|
|
|
bool m_isPlaying { true };
|
|
bool m_isFlipped { false };
|
|
};
|