Skip to content

Commit

Permalink
Added conversion from and to Vector to Sizef
Browse files Browse the repository at this point in the history
  • Loading branch information
Grumbel committed Aug 16, 2014
1 parent b641d01 commit ce72d36
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/math/sizef.hpp
Expand Up @@ -19,6 +19,8 @@

#include <iosfwd>

#include "math/vector.hpp"

class Size;

class Sizef
Expand All @@ -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_)
Expand Down Expand Up @@ -69,6 +76,11 @@ class Sizef
return *this;
}

Vector as_vector() const
{
return Vector(width, height);
}

public:
float width;
float height;
Expand Down

0 comments on commit ce72d36

Please sign in to comment.