Wondering if there is a reason SFML doesn't have a Zero Vector member (0,0). I understand that the Vector constructors will zero them by default, but there are (and always will be) situations where I don't want to instantiate a new vector.
Same goes for members such as: UnitX, UnitY, UnitX, One. You can imagine what these do.. Unit vectors are used alot in various trig calculations, and One is particularly useful when you want to multiply by a scalar.
template <typename T>
class Vector3
{
...
public:
static const Vector3<T> Zero;
};
template <typename T> Vector3<T> Vector3<T>::Zero = Vector3<T>(0.0f, 0.0f, 0.0f);
// Avoiding an extra copy
void SetPosition(const Vector2f& v);
SetPosition(Vector2f::Zero);
// vs.
SetPosition(Vector2f());
// Constructing a vector of all 42
Vector2i answerVec = Vector2i::One * 42;
Happy to submit a patch, if people think it's useful.
Even if the vector is set to zero at initialization and a zero vector feature wouldn't be an addition as such, I have to admit I faced the same situation which can be unclear about wether or not the vector would be (0,0).
Okay, the documentation probably says it does. But still when you read the code:
mSprite.setPosition(sf::Vector2f::Zero);
it's far clearer about what it does than
mSprite.setPosition(sf::Vector2f()); // have to jump to the doc to know what that does
Edit: it would have been the same about sf::Time if it hadn't sf::Time::Zero. sf::Time::Zero is useful.