Forum Archive

List of CGPoints

mikael

The following crashes on the last line and in objc_util.py on line 897. Any ideas how to get this working?

from objc_util import *
load_framework('SpriteKit')
SKShapeNode = ObjCClass('SKShapeNode')

cg_points = [CGPoint(0,0), CGPoint(10,5), CGPoint(5,0)]

node = SKShapeNode.shapeNodeWithSplinePoints_count_(cg_points, len(cg_points))
cvp

@mikael try this, I found something similar here

from objc_util import *

load_framework('SpriteKit')
SKShapeNode = ObjCClass('SKShapeNode')

cg_points = [CGPoint(0,0), CGPoint(10,5), CGPoint(5,0)]
cg_points_array = (CGPoint * len(cg_points))(*cg_points)
node = SKShapeNode.shapeNodeWithSplinePoints_count_(cg_points_array, len(cg_points), restype=c_void_p,argtypes=[POINTER(CGPoint), c_ulong])
mikael

@cvp, works splendidly, thank you! No way I would have gotten there on my own.

cvp

@mikael Obviously, but forum friends are there for that, isn't? Not always easy to search something, better if you (remember that you) got the same kind of problem.

mithrendal

🥰 I fully agree. But the „you“ is valid for you both.

cvp

@mithrendal Sure! That was obvious for me, perhaps due to my poor English.
When I speak about "remember", it is always a reference to my bad and old memory 😇

mithrendal

Vous etes super 😍 👍🏻 Je tellement aimes votre messages. That was my school french sorry it is poor too. 😌