Reputation: 159
Hello there fellow coders. I have been learning my way around GLKit over the past few weeks. I found this very helpful series of tutorials on how to set-up a basic 2D graphics engine found here.
When I followed the first chunk of 'Iteration 5' code something strange happened. The for loop in the updateVertices
method comes up with compiler errors. Those errors are shown here.
Here's the class code in it's entirety.
//
// Elipse.m
// EmptyGLKit
//
// Created by C-R on 8/6/13.
// Copyright (c) 2013 C-R. All rights reserved.
//
#import "Ellipse.h"
#define ELLIPSE_RESOLUTION 64;
#define M_TAU (2*M_PI)
@implementation Ellipse
-(int)numVertices {
return ELLIPSE_RESOLUTION;
}
-(void)updateVertices {
for (int i = 0; i < ELLIPSE_RESOLUTION; i++) {
float theta = ((float)i) / ELLIPSE_RESOLUTION * M_TAU;
self.vertices[i] = GLKVector2Make(cos(theta)*radiusX, sin(theta)*radiusY);
}
}
-(float)radiusX {
return radiusX;
}
-(void)setRadiusX:(float)_radiusX {
radiusX = _radiusX;
[self updateVertices];
}
-(float)radiusY {
return radiusY;
}
-(void)setRadiusY:(float)_radiusY {
radiusY = _radiusY;
[self updateVertices];
}
@end
I've tried closing and reopening the project, cleaning the code, rebooting Xcode, all without success.
To my knowledge that for loop is completely acceptable and has been in several other projects of mine.
Upvotes: 2
Views: 192
Reputation: 119031
Your #define
line has a ;
at the end. This isn't correct and should be removed. The #define
is basically substituted into the code for compilation so the end result is an if statement with too many ;
characters in it.
Upvotes: 13