AnimatedSprite class creation

This commit is contained in:
Crizomb 2025-06-15 17:28:53 +02:00
parent d849c8b037
commit adcd6146ed
3 changed files with 49 additions and 0 deletions

View 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
};