From 3180f83160e62777105ed93d7571ed5982c052a4 Mon Sep 17 00:00:00 2001 From: Laurent Gomila Date: Sun, 15 Jul 2012 14:56:23 +0200 Subject: [PATCH] Changed Transformable::setRotation so that the angle is always in [0 .. 360] --- src/SFML/Graphics/Transformable.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/SFML/Graphics/Transformable.cpp b/src/SFML/Graphics/Transformable.cpp index 418a9759..b63eb52d 100644 --- a/src/SFML/Graphics/Transformable.cpp +++ b/src/SFML/Graphics/Transformable.cpp @@ -71,7 +71,10 @@ void Transformable::setPosition(const Vector2f& position) //////////////////////////////////////////////////////////// void Transformable::setRotation(float angle) { - m_rotation = angle; + m_rotation = static_cast(fmod(angle, 360)); + if (m_rotation < 0) + m_rotation += 360.f; + m_transformNeedUpdate = true; m_inverseTransformNeedUpdate = true; }