<commit_before>#ifndef ENGINE_SPRITENODE_HPP
#define ENGINE_SPRITENODE_HPP

#include "Node.hpp"
#include "SFML/Graphics/Texture.hpp"
#include <functional>

namespace engine {

	class Animation {
	protected:
		std::vector<sf::IntRect> m_frames;
		bool m_looping;
		float m_speed;
		float m_currentTime;
		size_t m_currentFrame;
	public:
		Animation();

		void SetLooping(bool looping);

		bool IsLooping() const;

		std::vector<sf::IntRect>& GetFrames();

		void SetSpeed(float speed);

		float GetSpeed() const;

		void AddFrame(const sf::IntRect& frame);

		void Reset();

		void Update(float delta);

		const sf::IntRect& GetCurrentTexture();

		bool IsOver();

		std::function<void(void)> OnOver;
	};

	class SpriteNode : public Node {
	protected:
		const sf::Texture* m_texture;
		sf::Vertex m_vertices[4];
		sf::IntRect m_textureRect;
		std::map<std::string, Animation*> m_animations;
		std::string m_currentAnimation;
		bool m_animated;
		std::string m_animationWhenDone;
		bool m_vFlipped;
	public:
		SpriteNode(Scene* scene);

		virtual ~SpriteNode();

		void SetTexture(std::string path, const sf::IntRect* rect = nullptr);

		void SetTexture(sf::Texture* texture, const sf::IntRect* rect = nullptr);

		virtual bool initialize(Json::Value& root);

		virtual uint8_t GetType() const;

		void PlayAnimation(std::string name, std::string after = "");

		Animation* GetAnimation();<commit_msg>Add Animation::GetCurrentFrame<commit_after>#ifndef ENGINE_SPRITENODE_HPP
#define ENGINE_SPRITENODE_HPP

#include "Node.hpp"
#include "SFML/Graphics/Texture.hpp"
#include <functional>

namespace engine {

	class Animation {
	protected:
		std::vector<sf::IntRect> m_frames;
		bool m_looping;
		float m_speed;
		float m_currentTime;
		size_t m_currentFrame;
	public:
		Animation();

		void SetLooping(bool looping);

		bool IsLooping() const;

		std::vector<sf::IntRect>& GetFrames();

		void SetSpeed(float speed);

		float GetSpeed() const;

		void AddFrame(const sf::IntRect& frame);

		void Reset();

		void Update(float delta);

		const sf::IntRect& GetCurrentTexture();

		bool IsOver();

		std::function<void(void)> OnOver;

		size_t GetCurrentFrame() {
			return m_currentFrame;
		}
	};

	class SpriteNode : public Node {
	protected:
		const sf::Texture* m_texture;
		sf::Vertex m_vertices[4];
		sf::IntRect m_textureRect;
		std::map<std::string, Animation*> m_animations;
		std::string m_currentAnimation;
		bool m_animated;
		std::string m_animationWhenDone;
		bool m_vFlipped;
	public:
		SpriteNode(Scene* scene);

		virtual ~SpriteNode();

		void SetTexture(std::string path, const sf::IntRect* rect = nullptr);

		void SetTexture(sf::Texture* texture, const sf::IntRect* rect = nullptr);

		virtual bool initialize(Json::Value& root);

		virtual uint8_t GetType() const;

		void PlayAnimation(std::string name, std::string after = "");

		Animation* GetAnimation();
{'fraction_non_alphanumeric': 0.12347826086956522, 'fraction_numerical': 0.001391304347826087, 'mean_word_length': 5.279475982532751, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1756911', 'n_tokens_mistral': 1069, 'n_tokens_neox': 948, 'n_words': 232}