mirror of
https://github.com/HowestDAE/dae16-VerhulstBram.git
synced 2025-12-18 09:49:21 +01:00
Add player turning (Finally)
This commit is contained in:
@@ -4,12 +4,13 @@
|
||||
class Animation
|
||||
{
|
||||
public:
|
||||
Animation(Texture* pTexture, int frames, float frameDuration, Rectf srcRect);
|
||||
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) {
|
||||
m_isPlaying = isPlaying;
|
||||
@@ -18,6 +19,15 @@ public:
|
||||
m_isFlipped = isFlipped;
|
||||
}
|
||||
|
||||
void Reset() {
|
||||
m_CurrentFrame = 0;
|
||||
m_hasPlayedOnce = false;
|
||||
m_isPlaying = true;
|
||||
}
|
||||
bool IsDone() const {
|
||||
return m_hasPlayedOnce && !m_isLooping;
|
||||
}
|
||||
|
||||
private:
|
||||
Texture* m_pTexture;
|
||||
Rectf m_SrcRect;
|
||||
@@ -26,6 +36,11 @@ private:
|
||||
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 };
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user