Skip to content

Commit

Permalink
Make Sprite Equatable (#83)
Browse files Browse the repository at this point in the history
  • Loading branch information
finnvoor committed Aug 12, 2024
1 parent e184ce2 commit 0a78ea5
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion Sources/PlaydateKit/Core/Sprite.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ public import CPlaydate
public enum Sprite {
// MARK: Open

open class Sprite {
open class Sprite: Equatable {
// MARK: Lifecycle

/// Allocates and returns a new Sprite.
Expand Down Expand Up @@ -184,6 +184,10 @@ public enum Sprite {
return UnsafeBufferPointer(start: sprites, count: Int(length))
}

public static func == (lhs: Sprite, rhs: Sprite) -> Bool {
lhs.pointer == rhs.pointer
}

/// Allocates and returns a copy of the sprite.
public func copy() -> Sprite {
Sprite(pointer: sprite.copy.unsafelyUnwrapped(pointer).unsafelyUnwrapped)
Expand Down

0 comments on commit 0a78ea5

Please sign in to comment.