Reputation: 1326
I am positioning an image sprite at location (0,0) so that left edge of screen co incides with left edge of image. But the image always appears at the center of the screen, with both the image and screen's center coinciding.
The size of the CCImage
is 854 x 480 and getVisibleSize()
returns 320 x 240.
To display the sprite with the image's left coinciding with the screen's left edge I have to setPosition
at x= -264
I have gone through this wiki at cocos2dx wiki co-ordinates systems which says that (0,0) starts at left bottom. I have also seen Cocos2d-x reference of setPosition method which iterates the same.
Am I missing something? Any ideas why this may be happening?
UPDATE
I think I should mention that I am using the CCLayerPanZoom
extension for this.
getAnchorPoint()
returns x = 0.5 and y = 0.5
Upvotes: 0
Views: 909
Reputation: 141
This will position your image sprite to left bottom of screen:
sprite->setAnchorPoint(CCPoint(0, 0));
sprite->setPosition( ccp(0,0));
Upvotes: 0