给定以下代码,为什么圆形和矩形图像显示的距离如此之远?
CGPoint center = ccp(winSize.width/2, winSize.height/2);
[rectangle setPosition:center];
[circle setPosition:ccp(winSize.width/2, winSize.height/2)];
这是用于创建矩形的代码:
glEnable(GL_LINE_SMOOTH);
glColor4ub(255, 255, 255, 255);
glLineWidth(2);
CGPoint vertices2[] = { ccp(79,299), ccp(134,299), ccp(134,229), ccp(79,229) };
ccDrawPoly(vertices2, 4, YES);
-(id) init {
if((self = [super init])) {
CGSize winSize = [CCDirector sharedDirector].winSize;
[CCTexture2D setDefaultAlphaPixelFormat:kCCTexture2DPixelFormat_RGB565];
background = [CCSprite spriteWithFile:@"blue-shooting-stars.png"];
background.anchorPoint = ccp(0,0);
[CCTexture2D setDefaultAlphaPixelFormat:kCCTexture2DPixelFormat_Default];
Circle *circle = [[Circle alloc] init];
[circle setPosition:ccp(winSize.width/2.0f, winSize.height/2.0f)];
CGPoint center = ccp(winSize.width/2.0f, winSize.height/2.0f);
Rectangle *rectangle = [[Rectangle alloc] init];
[rectangle setPosition:center];
[self addChild:circle];
[self addChild:rectangle];
}
return self;
}