Added conversion from and to Vector to Sizef
authorIngo Ruhnke <grumbel@gmail.com>
Sat, 16 Aug 2014 19:49:12 +0000 (21:49 +0200)
committerIngo Ruhnke <grumbel@gmail.com>
Sat, 16 Aug 2014 19:49:12 +0000 (21:49 +0200)
src/math/sizef.hpp

index 636416a..893d0d4 100644 (file)
@@ -19,6 +19,8 @@
 
 #include <iosfwd>
 
+#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;