Added convenience overloads to Rect and also, Collection conformance in the Playdate bindings target.

This commit is contained in:
2026-07-26 00:31:58 +02:00
parent 41558399e3
commit 0d0b397ce1
5 changed files with 92 additions and 0 deletions
@@ -33,6 +33,12 @@ extension Graphics {
top: Int32(top), bottom: Int32(bottom))
}
/// The rect's width.
public var width: Int { right - left }
/// The rect's height.
public var height: Int { bottom - top }
/// Returns the rect offset by (dx, dy).
public func translated(dx: Int, dy: Int) -> Rect {
Rect(left: left + dx, right: right + dx, top: top + dy, bottom: bottom + dy)