var sx:Float = 0.0
var sy:Float = 0.0
var mx:Float = 0.0
var my:Float = 0.0
var ex:Float = 0.0
var ey:Float = 0.0
// ——————————– タッチ開始時に呼ばれる ———————————
override func touchesBegan(_ touches: Set<UITouch>, with event: UIEvent?) {
//タッチオブジェクトの取得
let touch = touches.first!
let location = touch.location(in: self.view)
sx = Float(location.x)
sy = Float(location.y)
}
// —————————— タッチ移動時に呼ばれる ———————————
override func touchesMoved(_ touches: Set<UITouch>, with event: UIEvent?) {
let touch = touches.first!
let location = touch.location(in: self.view)
mx = Float(location.x)
my = Float(location.y)
}
// —————————- タッチ終了時に呼ばれる ————————————–
override func touchesEnded(_ touches: Set<UITouch>, with event: UIEvent?) {
let touch = touches.first!
let location = touch.location(in: self.view)
ex = Float(location.x)
ey = Float(location.y)
}