2026-07-25 12:39:32 +02:00
|
|
|
internal import CPlaydate
|
|
|
|
|
|
|
|
|
|
extension Sprite {
|
2026-09-18 12:45:39 +02:00
|
|
|
/// A sprite intersected by a line segment. Wraps `SpriteQueryInfo`.
|
2026-07-25 12:39:32 +02:00
|
|
|
public struct QueryInfo {
|
|
|
|
|
public let sprite: Sprite
|
2026-09-18 12:45:39 +02:00
|
|
|
/// Entry point's position along the segment, 0...1.
|
2026-07-25 12:39:32 +02:00
|
|
|
public let ti1: Float
|
2026-09-18 12:45:39 +02:00
|
|
|
/// Exit point's position along the segment, 0...1.
|
2026-07-25 12:39:32 +02:00
|
|
|
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)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|