Skip to content

Commit

Permalink
Revert "Uncomment sprite draw function (#65)"
Browse files Browse the repository at this point in the history
This reverts commit 5d408f8.
  • Loading branch information
finnvoor committed Jul 2, 2024
1 parent 1c24347 commit 0c509d1
Showing 1 changed file with 12 additions and 11 deletions.
23 changes: 12 additions & 11 deletions Sources/PlaydateKit/Core/Sprite.swift
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@ public enum Sprite {
let sprite = unsafeBitCast(userdata, to: Sprite.self)
sprite.update()
}
setDrawFunction { sprite, bounds, drawRect in
let userdata = PlaydateKit.Sprite.getUserdata(sprite.unsafelyUnwrapped).unsafelyUnwrapped
let sprite = unsafeBitCast(userdata, to: Sprite.self)
sprite.draw(bounds: Rect(bounds), drawRect: Rect(drawRect))
}
// setDrawFunction { sprite, bounds, drawRect in
// let userdata = PlaydateKit.Sprite.getUserdata(sprite.unsafelyUnwrapped).unsafelyUnwrapped
// let sprite = unsafeBitCast(userdata, to: Sprite.self)
// sprite.draw(bounds: Rect(bounds), drawRect: Rect(drawRect))
// }
setCollisionResponseFunction { sprite, other in
let spriteUserdata = PlaydateKit.Sprite.getUserdata(sprite.unsafelyUnwrapped)
let sprite = unsafeBitCast(spriteUserdata, to: Sprite.self)
Expand All @@ -42,11 +42,11 @@ public enum Sprite {
let sprite = unsafeBitCast(userdata, to: Sprite.self)
sprite.update()
}
setDrawFunction { sprite, bounds, drawRect in
let userdata = PlaydateKit.Sprite.getUserdata(sprite.unsafelyUnwrapped).unsafelyUnwrapped
let sprite = unsafeBitCast(userdata, to: Sprite.self)
sprite.draw(bounds: Rect(bounds), drawRect: Rect(drawRect))
}
// setDrawFunction { sprite, bounds, drawRect in
// let userdata = PlaydateKit.Sprite.getUserdata(sprite.unsafelyUnwrapped).unsafelyUnwrapped
// let sprite = unsafeBitCast(userdata, to: Sprite.self)
// sprite.draw(bounds: Rect(bounds), drawRect: Rect(drawRect))
// }
setCollisionResponseFunction { sprite, other in
let spriteUserdata = PlaydateKit.Sprite.getUserdata(sprite.unsafelyUnwrapped)
let sprite = unsafeBitCast(spriteUserdata, to: Sprite.self)
Expand All @@ -66,7 +66,8 @@ public enum Sprite {

/// If the sprite doesn’t have an image, the sprite’s draw function is called as needed to update the display. Note that this method
/// is only called when the sprite is on screen and has a size specified via ``setSize(width:height:)`` or ``bounds``.
open func draw(bounds _: Rect<Float>, drawRect _: Rect<Float>) {}
/// > Warning: This currently does not work due to [apple/swift/issues/72626](https://github.com/apple/swift/issues/72626)
@available(*, unavailable) open func draw(bounds _: Rect<Float>, drawRect _: Rect<Float>) {}

/// Override to control the type of collision response that should happen when a collision with other occurs.
///
Expand Down

0 comments on commit 0c509d1

Please sign in to comment.