Changed Transformable::setRotation so that the angle is always in [0 .. 360]

This commit is contained in:
Laurent Gomila 2012-07-15 14:56:23 +02:00
parent e85bd1baf6
commit 3180f83160

View File

@ -71,7 +71,10 @@ void Transformable::setPosition(const Vector2f& position)
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
void Transformable::setRotation(float angle) void Transformable::setRotation(float angle)
{ {
m_rotation = angle; m_rotation = static_cast<float>(fmod(angle, 360));
if (m_rotation < 0)
m_rotation += 360.f;
m_transformNeedUpdate = true; m_transformNeedUpdate = true;
m_inverseTransformNeedUpdate = true; m_inverseTransformNeedUpdate = true;
} }