mirror of
https://github.com/HowestDAE/dae16-VerhulstBram.git
synced 2025-12-18 09:49:21 +01:00
Reformat + Basic animation system
General fixes
This commit is contained in:
30
Game/Animations/Animation.h
Normal file
30
Game/Animations/Animation.h
Normal file
@@ -0,0 +1,30 @@
|
||||
#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 Point2f& pos, float angle = 0.0f) 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 };
|
||||
};
|
||||
Reference in New Issue
Block a user