Hello I'm new with this library and in the forum. I cannot see the option to insert code.
I'm dealing with the particle system and learning all about it. I read that you can create your own distributions and apply it to the particles properties like the lifetime, rotation, position, etc.
For example:
thor::UniversalEmitter emitter;
emitter.setParticleLifetime(thor::Distributions::uniform(sf::seconds(1.f), sf::seconds(3.f)));
I tried to make the same but with my own distribution following the documentation.
unsigned int seed = std::chrono::system_clock::now().time_since_epoch().count();
std::mt19937 engine(seed);
std::uniform_real_distribution<float> distr(1.f, 3.f);
auto randomizer = std::bind(distr, engine);
thor::Distribution<float> thorDistr(randomizer);
thor::UniversalEmitter emitter;
emitter.setParticleLifetime(sf::seconds(thorDistr()));
This solution gives the same lifetime to all the particles, therefore it fails.
I think that I must use something like this but the library doesn't allow to do it or maibe I don't know how to implement it correctly:
unsigned int seed = std::chrono::system_clock::now().time_since_epoch().count();
std::mt19937 engine(seed);
std::uniform_real_distribution<float> distr(1.f, 3.f);
auto randomizer = std::bind(distr, engine);
thor::Distribution<sf::Time> thorDistr(randomizer);
thor::UniversalEmitter emitter;
emitter.setParticleLifetime(thorDistr().asSeconds());
Do you how I can implement it?