CGPoint zu NSValue und umgekehrt
Ich habe code:
NSMutableArray *vertices = [[NSMutableArray alloc] init];
//Getting mouse coordinates
loc = [self convertPoint: [event locationInWindow] fromView:self];
[vertices addObject:loc]; // Adding coordinates to NSMutableArray
//Converting from NSMutableArray to GLfloat to work with OpenGL
int count = [vertices count] * 2; // * 2 for the two coordinates of a loc object
GLFloat []glVertices = (GLFloat *)malloc(count * sizeof(GLFloat));
int currIndex = 0;
for (YourLocObject *loc in vertices) {
glVertices[currIndex++] = loc.x;
glVertices[currIndex++] = loc.y;
}
loc
ist CGPoint, also muss ich irgendwie von CGPoint zu NSValue wechseln, um es zu NSMutableArray hinzuzufügen und danach wieder in CGPoint zu konvertieren. Wie könnte es gemacht werden?