17 #ifndef HEADER_SUPERTUX_MATH_SIZEF_HPP 18 #define HEADER_SUPERTUX_MATH_SIZEF_HPP 22 #include "math/vector.hpp" 34 explicit Sizef(
const Vector& v) :
39 Sizef(
float width_,
float height_) :
49 Sizef& operator*=(
float factor)
56 Sizef& operator/=(
float divisor)
77 Vector as_vector()
const 79 return Vector(width, height);
84 return width > 0 && height > 0;
92 inline Sizef operator*(
const Sizef& lhs,
float factor)
94 return Sizef(lhs.width * factor,
98 inline Sizef operator*(
float factor,
const Sizef& rhs)
100 return Sizef(rhs.width * factor,
101 rhs.height * factor);
104 inline Sizef operator/(
const Sizef& lhs,
float divisor)
106 return Sizef(lhs.width / divisor,
107 lhs.height / divisor);
112 return Sizef(lhs.width + rhs.width,
113 lhs.height + rhs.height);
118 return Sizef(lhs.width - rhs.width,
119 lhs.height - rhs.height);
122 inline bool operator==(
const Sizef& lhs,
const Sizef& rhs)
124 return (lhs.width == rhs.width) && (rhs.height == rhs.height);
127 inline bool operator!=(
const Sizef& lhs,
const Sizef& rhs)
129 return (lhs.width != rhs.width) || (lhs.height != rhs.height);
132 std::ostream& operator<<(std::ostream& s,
const Sizef& size);