aboutsummaryrefslogtreecommitdiff
path: root/include/cru/platform
diff options
context:
space:
mode:
Diffstat (limited to 'include/cru/platform')
-rw-r--r--include/cru/platform/GraphicsBase.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/include/cru/platform/GraphicsBase.h b/include/cru/platform/GraphicsBase.h
index 89d3df77..dccff4e1 100644
--- a/include/cru/platform/GraphicsBase.h
+++ b/include/cru/platform/GraphicsBase.h
@@ -155,6 +155,11 @@ struct Rect final {
return Rect(left, top, right - left, bottom - top);
}
+ constexpr static Rect FromVertices(const Point& lefttop,
+ const Point& rightbottom) {
+ return Rect(lefttop.x, lefttop.y, rightbottom.x - lefttop.x, rightbottom.y - lefttop.y);
+ }
+
constexpr static Rect FromCenter(const Point& center, const float width,
const float height) {
return Rect(center.x - width / 2.0f, center.y - height / 2.0f, width,