8 #include <SFML/Graphics/Color.hpp> 9 #include <SFML/Graphics/Drawable.hpp> 10 #include <SFML/Graphics/RenderStates.hpp> 11 #include <SFML/Graphics/RenderTarget.hpp> 12 #include <SFML/Graphics/Texture.hpp> 14 #include <NasNas/core/data/Rect.hpp> 15 #include <NasNas/core/graphics/Sprite.hpp> 16 #include <NasNas/core/graphics/SpriteBatch.hpp> 24 sf::Vector2f velocity = {0.f,0.f};
25 sf::Color color = sf::Color::White;
27 auto getAge()
const ->
float {
return age; }
40 void setTexture(
const sf::Texture& texture);
41 void setEmitRate(
float rate);
42 void emit(
const sf::IntRect& rect,
int nb,
bool repeat=
false);
43 void emitBurst(
const sf::IntRect& rect,
int nb);
45 auto getParticleCount()
const -> unsigned;
47 void setPosition(
float x,
float y);
48 void setPosition(
const sf::Vector2f& pos);
49 auto getPosition()
const -> sf::Vector2f;
52 virtual void onParticleCreate(
Particle& particle) = 0;
53 virtual void onParticleUpdate(
Particle& particle) = 0;
58 void updateParticle(
Particle& particle,
float dt);
59 void draw(sf::RenderTarget& target, sf::RenderStates states)
const override;
61 const sf::Texture* m_texture =
nullptr;
62 sf::Vector2f m_position;
63 std::vector<std::unique_ptr<Particle>> m_particles;
64 float m_rate = 9999.f;
65 float m_to_emmit = 0.f;