From ce72d3661ad983b652e742baeb3bce2691b532aa Mon Sep 17 00:00:00 2001 From: Ingo Ruhnke Date: Sat, 16 Aug 2014 21:49:12 +0200 Subject: [PATCH] Added conversion from and to Vector to Sizef --- src/math/sizef.hpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/math/sizef.hpp b/src/math/sizef.hpp index 636416a56a7..893d0d4ea8e 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 @@ class Sizef 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 @@ class Sizef return *this; } + Vector as_vector() const + { + return Vector(width, height); + } + public: float width; float height;