diff options
Diffstat (limited to 'include/cru/platform/GraphicsBase.h')
| -rw-r--r-- | include/cru/platform/GraphicsBase.h | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/include/cru/platform/GraphicsBase.h b/include/cru/platform/GraphicsBase.h index dccff4e1..81c44cb6 100644 --- a/include/cru/platform/GraphicsBase.h +++ b/include/cru/platform/GraphicsBase.h @@ -157,7 +157,8 @@ struct Rect final { constexpr static Rect FromVertices(const Point& lefttop, const Point& rightbottom) { - return Rect(lefttop.x, lefttop.y, rightbottom.x - lefttop.x, rightbottom.y - lefttop.y); + return Rect(lefttop.x, lefttop.y, rightbottom.x - lefttop.x, + rightbottom.y - lefttop.y); } constexpr static Rect FromCenter(const Point& center, const float width, @@ -215,6 +216,10 @@ struct Rect final { return result; } + constexpr Rect Scale(float scale) const { + return {left * scale, top * scale, width * scale, height * scale}; + } + constexpr bool IsPointInside(const Point& point) const { return point.x >= left && point.x < GetRight() && point.y >= top && point.y < GetBottom(); |
