Я пытаюсь создать собственный SKShapeNode на основе массива точек. Точки образуют замкнутую форму, и в конечном итоге фигура должна быть заполнена.
Это то, что я придумал до сих пор, но по какой-то причине штрих рисуется нормально, но форма остается пустой. Что я пропустил?
override func didMoveToView(view: SKView)
{
let center = CGPointMake(CGRectGetMidX(self.frame), CGRectGetMidY(self.frame))
let path = CGPathCreateMutable()
CGPathMoveToPoint(path, nil, center.x, center.y)
CGPathAddLineToPoint(path, nil, center.x + 50, center.y + 50)
CGPathMoveToPoint(path, nil, center.x + 50, center.y + 50)
CGPathAddLineToPoint(path, nil, center.x - 50, center.y + 50)
CGPathMoveToPoint(path, nil, center.x - 50, center.y + 50)
CGPathAddLineToPoint(path, nil, center.x - 50, center.y - 50)
CGPathMoveToPoint(path, nil, center.x - 50, center.y - 50)
CGPathAddLineToPoint(path, nil, center.x, center.y)
CGPathCloseSubpath(path)
let shape = SKShapeNode(path: path)
shape.strokeColor = SKColor.blueColor()
shape.fillColor = SKColor.redColor()
self.addChild(shape)
}