-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAnimation.h
More file actions
25 lines (24 loc) · 731 Bytes
/
Animation.h
File metadata and controls
25 lines (24 loc) · 731 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#pragma once
#include "Vec2.h"
#include "SFML/Graphics.hpp"
class Animation
{
//this class handles animation - sprite based
//it will iterate over provided frame based on provided size or speed
private:
sf::Sprite m_sprite;//NOTE sprite keep only a pointer reference to texture
int m_frameCountX;
int m_frameCountY;
int m_currentFrame;
int m_speed;
std::string m_name;
Vec2 m_size;
public :
Animation();
Animation(const std::string & name, sf::Texture & t, int frameCountX, int frameCountY, int speed);
void update();
bool hasEnded() const;//if it is a non looping animation - it will be ended when last frame reached
const std::string & getName() const;
const Vec2 & getSize() const;
sf::Sprite & getSprite();
};