AnimatedSprite class creation
This commit is contained in:
parent
d849c8b037
commit
adcd6146ed
3 changed files with 49 additions and 0 deletions
17
SimpleGame/src/Include/AnimatedSprite.hpp
Normal file
17
SimpleGame/src/Include/AnimatedSprite.hpp
Normal file
|
@ -0,0 +1,17 @@
|
|||
#pragma once
|
||||
#include <SFML/Graphics/Sprite.hpp>
|
||||
#include <SFML/Graphics/Texture.hpp>
|
||||
#include <vector>
|
||||
|
||||
class AnimatedSprite : public sf::Sprite {
|
||||
private:
|
||||
std::vector<sf::Texture> frames_textures;
|
||||
float time_beetwen_frames = 0.5;
|
||||
float time_without_change = 0.0;
|
||||
int current_frame = 0;
|
||||
|
||||
public:
|
||||
AnimatedSprite(const std::vector<std::string> &texture_paths);
|
||||
void update(float dtime);
|
||||
// draw will be same as sf::Sprite
|
||||
};
|
Loading…
Add table
Add a link
Reference in a new issue