From: Ingo Ruhnke Date: Sat, 16 Aug 2014 19:49:12 +0000 (+0200) Subject: Added conversion from and to Vector to Sizef X-Git-Url: https://git.verplant.org/?a=commitdiff_plain;h=ce72d3661ad983b652e742baeb3bce2691b532aa;p=supertux.git Added conversion from and to Vector to Sizef --- diff --git a/src/math/sizef.hpp b/src/math/sizef.hpp index 636416a56..893d0d4ea 100644 --- a/src/math/sizef.hpp +++ b/src/math/sizef.hpp @@ -19,6 +19,8 @@ #include +#include "math/vector.hpp" + class Size; class Sizef @@ -29,6 +31,11 @@ public: height(0.0f) {} + Sizef(const Vector& v) : + width(v.x), + height(v.y) + {} + Sizef(float width_, float height_) : width(width_), height(height_) @@ -69,6 +76,11 @@ public: return *this; } + Vector as_vector() const + { + return Vector(width, height); + } + public: float width; float height;