MacOS support

main
Mathieu GROUSSEAU 5 days ago
parent 595996f639
commit b70eba3860

@ -76,41 +76,29 @@ class PieceNode : SKNode {
} }
#if os(macOS) #if os(macOS)
// override public func touchesBegan(with event: NSEvent) { override public func mouseDown(with event: NSEvent) {
// let holder: NSView? = self.parent?.parent as? NSView guard let holder = self.parent
// else { return }
// guard
// self.draggable, let pos = event.location(in: holder)
// let touch = event.touches(matching: .began, in: holder).first self.dragTo(position: CGPoint(x: pos.x, y: pos.y))
// else { return } }
//
// let pos = touch.location(in: holder) override public func mouseDragged(with event: NSEvent) {
// self.position = CGPoint(x: pos.y, y: pos.y) guard let holder = self.parent
// } else { return }
//
// override public func touchesMoved(with event: NSEvent) { let pos = event.location(in: holder)
// let holder: NSView? = self.parent?.parent as? NSView self.dragTo(position: CGPoint(x: pos.x, y: pos.y))
// }
// guard
// self.draggable, override public func mouseUp(with event: NSEvent) {
// let touch = event.touches(matching: .moved, in: holder).first guard let holder = self.parent
// else { return } else { return }
//
// let pos = touch.location(in: holder) let pos = event.location(in: holder)
// self.position = CGPoint(x: pos.y, y: pos.y) self.releaseAt(position: CGPoint(x: pos.x, y: pos.y))
// } }
//
// override public func touchesEnded(with event: NSEvent) {
// let holder: NSView? = self.parent?.parent as? NSView
//
// guard
// self.draggable,
// let touch = event.touches(matching: .ended, in: holder).first
// else { return }
//
// let pos = touch.location(in: holder)
// self.position = CGPoint(x: pos.y, y: pos.y)
// }
#elseif os(iOS) #elseif os(iOS)
override public func touchesBegan(_ touches: Set<UITouch>, with event: UIEvent?) { override public func touchesBegan(_ touches: Set<UITouch>, with event: UIEvent?) {
guard guard

Loading…
Cancel
Save