SFML community forums
Help => General => Topic started by: mimipim on June 24, 2011, 12:49:26 am
-
Laurent, can you share how Randomizer work(code) in SFML 1.6 because now with SFML 2 I can't get same effect with my own rand function (it's seems working like randomizer in sfml 1.6 but....)
:?
Oups... wrong sub-forum maybe. Sorry.
-
Just look at Randomizer.cpp, the implementation is open-source.
-
sf::Randomizer had the simplest implementation possible.
- rand() % range + min for integers
- rand() * range / RAND_MAX + min for floats
-
Jsf::Randomizer had the simplest implementation possible.
- rand() % range + min for integers
- rand() * range / RAND_MAX + min for floats
Laurent, this seems is not like sf::Randomizer because if I put for range 10 and min = -10 it's returning values from -10 to 0.
EDIT: I'll check now the source file.
EDIT 2: Yep, i found it and source was a litle bit different (just like my function), so this was not the reason my bolt effect is not like my bolt effect in SFML 1.6 with same source.
I'll try to found wath make it different.
Thanks for helping me. :)
I just wanna ask is there something changed in direction or angles in SFML 2 ?
-
Laurent, this seems is not like sf::Randomizer because if I put for range 10 and min = -10 it's returning values from -10 to 0.
Isn't this exactly how it should be? The interval includes the last value, unlike STL ranges.
I just wanna ask is there something changed in direction or angles in SFML 2 ?
Yes, the sign of angles has been changed in SFML 2. The reasons are explained here (http://www.sfml-dev.org/forum/viewtopic.php?t=4467).
-
Thanks guys! I fixed it. :)