So, the title says it all. Despite the description text of sf::transformables function sf::getrotation says:
get the orientation of the object
The rotation is always in the range [0, 360].
Returns:
Current rotation, in degrees
So is this untrue or not? To see the rotation I'm using
std::ostringstream ss;
ss.str("");
ss << player.getRotation();
VelocityText.setString(sf::String(ss.str()));
and then drawing VelocityText to the screen.
It would be nice if you could describe your actual problem. All I see in your first post is "is the documentation correct?", but you don't describe what you do, and what results you get. A complete and minimal code that reproduces the problem would be perfect. And yes, first make sure that your version is not too old.
I am using the SFML 2.0 rc. I'm not quite sure how to check what exact version I have.
It isn't exactly a big problem it merely complicates my calculation during rotation of objects. What I merely meant it that a sprite which is rotated above 360 degrees or below 0 degrees will, when you call its getRotation function, return precisely that, a value above 360 or below 0.
Since the documentation explicitly states that the value returned by getRotation would be between 0 and 360, I merely wondered whether you should change that statement in the documentation as it is not (to my experience)correct.
(or include this code in the rotate/getRotation function)
if(this->getRotation() >= 360)
{
this->rotate(-360);
}
else if(this->getRotation() < 0)
{
this->rotate(360);
}
The problem itself is easily replicable, just create a sprite, rotate it and print its rotation(using the getRotation function).
EDIT: I just looked over the first post/thread name and saw how sloppy it looked. Very sorry for that.
The documentation is correct, the rotation should never be out of the range [0 .. 360].
That's why we need to see your code.
The problem itself is easily replicable, just create a sprite, rotate it and print its rotation(using the getRotation function).
So please provide the code. Even if it's short and simple, it's better if written once by you and simply copied by everyone else. And this way we are also sure that your code and our code is exactly the same. No stupid mistake.
Ok, here is a functioning example.
void main()
{
sf::RenderWindow App(sf::VideoMode::VideoMode(320,480),"Test!",sf::Style::Default);
sf::Text VelocityText;
std::ostringstream ss;
sf::Sprite extraeye;
sf::Texture Eye;
Eye.loadFromFile("Graphics/eye.png");
extraeye.setTexture(Eye);
while(App.isOpen())
{
extraeye.setOrigin(extraeye.getLocalBounds().width/2,extraeye.getLocalBounds().height/2);
extraeye.rotate(10.f);
ss.str("");
ss << extraeye.getRotation();
VelocityText.setString(sf::String(ss.str()));
App.clear();
App.draw(extraeye);
App.draw(VelocityText);
App.display();
}
}
(You will have to use your own texture tho :P)