X-Git-Url: http://git.localhorst.tv/?a=blobdiff_plain;f=src%2Fmath%2FVector.h;h=6cb9ba333ba33cb7974f80cc76d9265de6e55d56;hb=06db9f596cd1c5aa4c0832b387882f7c74c1b4c0;hp=fb07d338986fa2f4b9c0373bc808b911efd18ec0;hpb=a3ba4dc677ad7c92eeb78b20b642241563605c9d;p=l2e.git diff --git a/src/math/Vector.h b/src/math/Vector.h index fb07d33..6cb9ba3 100644 --- a/src/math/Vector.h +++ b/src/math/Vector.h @@ -1,6 +1,8 @@ #ifndef MATH_VECTOR_H_ #define MATH_VECTOR_H_ +#include "Fixed.h" + #include #include #include @@ -16,7 +18,7 @@ public: Vector() : x(0), y(0) { } Vector(Scalar x, Scalar y) : x(x), y(y) { } template - Vector(const Vector &other) : x(other.X()), y(other.Y()) { }; + Vector(const Vector &other) : x(other.X()), y(other.Y()) { } template Vector(T x, T y) : x(x), y(y) { } @@ -85,8 +87,8 @@ template inline Vector operator *(const Vector &v1, const Vector &v2) { return Vector(v1.X() * v2.X(), v1.Y() * v2.Y()); } -template -inline Vector operator *(const Vector &v, T s) { +template +inline Vector operator *(const Vector &v, U s) { return Vector(v.X() * s, v.Y() * s); } template @@ -176,6 +178,16 @@ void Vector::Lock(const Vector &to) { } +template +Vector ToInt(const Vector > &v) { + return Vector(v.X().Int(), v.Y().Int()); +} +template +Vector > ToFixed(const Vector &v) { + return Vector >(v.X(), v.Y()); +} + + } -#endif /* GEOMETRY_VECTOR_H_ */ +#endif