Hello,
I am very new to the whole iphone thing, but I decided to give Cocos2D a go for my first project.
I like the idea very much so far!
I just have a question. I'm not sure if i'm doing something wrong, or if it's a bug (i'm using 0.8 beta).
As a test I made a scene, containing a layer that draws random circles on itself. I'm using the layers schedule feature to call [self draw] in the "tick" function. It all works great, but no matter what interval I use for the scheduler, the circles are beeing drawn like crazy (tens of times per second). I tried things like 1.0f, 0.5f, 1, 100, ... but they all end up redrawing at the same insane speed. I don't have a clue, since I'm doing exactly what the examples online do.
Here is my layer code:
@implementation StartMenu_Background
-(id) init {
self = [super init];
if (self) {
[self schedule:@selector(tick:) interval:1.0f];
}
return self;
}
-(void) tick: (ccTime) dt {
[self draw];
NSLog(@"%@", self);
}
-(void) draw {
glLineWidth(3);
glColor4ub(0, 125, 125, 255);
drawCircle( ccp(RANDOM_INT(0, 480), RANDOM_INT(0,320)), 10, 0, 10, NO);
}
@end
It works, just way to fast. Anyone knows what I'm doing wrong?