Skip to content

Commit aeca877

Browse files
committed
make Size2 comparable
1 parent d9eae08 commit aeca877

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

Sources/GameMath/2D Types/Size2.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ public struct Size2: Vector2, Sendable {
3131

3232
extension Size2: Equatable {}
3333
extension Size2: Hashable {}
34+
extension Size2: Comparable {}
3435
extension Size2: Codable {}
3536

3637
//MARK: Vector2

Sources/GameMath/2D Types/Vector2.swift

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -221,6 +221,12 @@ public func max<V: Vector2>(_ lhs: V, _ rhs: V) -> V {
221221
return V.init(max(lhs.x, rhs.x), max(lhs.y, rhs.y))
222222
}
223223

224+
public extension Vector2 {
225+
static func < (lhs: Self, rhs: Self) -> Bool {
226+
return lhs.x < rhs.x && lhs.y < rhs.y
227+
}
228+
}
229+
224230
//MARK: Operators (Self)
225231
extension Vector2 {
226232
//Multiplication

0 commit comments

Comments
 (0)