This PR contains the work done to update the library and the attached example project to use the Swift 6.4 computer as a minimum supported version and also, to use the latest features introduced in it. Reviewed-on: #1 Co-authored-by: Javier Cicchelli <javier@rock-n-code.com>
23 lines
759 B
Swift
23 lines
759 B
Swift
internal import CPlaydate
|
|
|
|
extension Sprite {
|
|
/// A sprite intersected by a line segment. Wraps `SpriteQueryInfo`.
|
|
public struct QueryInfo {
|
|
public let sprite: Sprite
|
|
/// Entry point's position along the segment, 0...1.
|
|
public let ti1: Float
|
|
/// Exit point's position along the segment, 0...1.
|
|
public let ti2: Float
|
|
public let entryPoint: (x: Float, y: Float)
|
|
public let exitPoint: (x: Float, y: Float)
|
|
|
|
init(_ info: SpriteQueryInfo) {
|
|
sprite = Sprite.wrapper(for: info.sprite)
|
|
ti1 = info.ti1
|
|
ti2 = info.ti2
|
|
entryPoint = (info.entryPoint.x, info.entryPoint.y)
|
|
exitPoint = (info.exitPoint.x, info.exitPoint.y)
|
|
}
|
|
}
|
|
}
|