ccDrawRect does not draw at proper position[Resolved]

ccDrawRect does not draw at proper position[Resolved]
0.0 0


Hi guys,
I have met a weired problem. I extends CCNode class to draw a rect, which draws where I touch on the screen. At only one point near zero(to its parent), it performs well, at others, it begin to fly to other points. I logged the transferred touch point, the coordinates is right, but the rect appears in completely different places. Is there any scale property that not right?
Any advice will be appreciated!


anybody can help?


Could you please paste some sample code and image for this issue?


void YGOCardFrame::draw() { glLineWidth(mFrameSize); ccDrawColor4B(255, 255, 255, 255); CCPoint orgPoint = getPosition(); ccDrawRect(ccp(orgPoint.x - mFrameSize, orgPoint.y - mFrameSize), ccp((orgPoint.x + mInternalSize.width + mFrameSize), (orgPoint.y + mInternalSize.height + mFrameSize))); }
YGOCardFrame extends from CCNode, I create one YGOCardFrame instance and then add it into a container, thus use setPosition change its position.


Hi, what version of engine do you use? As far as I am concerned, CCDrawXXX() function has been deprecated and its function has been replaced by drawNode since version 3.0.


I finally resolved this problem by using CCDrawNode.