1
CGRect targetRect = CGRect.make(target.getPosition().x - (target.getContentSize().width),
            target.getPosition().y - (target.getContentSize().height),
            target.getContentSize().width,
            target.getContentSize().height);

目标是一个精灵......我在精灵的边界上创建了一个矩形。我试图通过 draw(GL10 gl) 来完成这项工作,但我没有办法调用它。所以,如果有人知道如何做到这一点。请帮我解决这个问题...在此先感谢

4

1 回答 1

2
public void draw(GL10 gl){
        gl.glColor4f(0.0f, 0.0f, 1.0f, 1.0f);
        gl.glLineWidth(4);
        CCDrawingPrimitives.ccDrawCircle(gl, centerAnchor, 20*scaleX, ccMacros.CC_DEGREES_TO_RADIANS(90), 50, true);

            CCDrawingPrimitives.ccDrawCircle(gl, CGPoint.make((handposition.x-40f)*scaleX,(handposition.y+10f)*scaleY), 45*scaleX, ccMacros.CC_DEGREES_TO_RADIANS(90), 50, true);

            CCDrawingPrimitives.ccDrawPoint(gl, centerAnchor);

        gl.glLineWidth(1);
        gl.glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
        gl.glPointSize(1);
    }

同样,您可以使用 ccDrawRect() 方法绘制矩形

于 2013-08-14T13:37:04.420 回答