0

I want to draw a rectangle shape using cocos2d-android . i googled all my way to draw the rectangle in my scene and trying

CGRect rect = CGRect.make(numbers[0][0],numbers[0][1],70,70);

but it was not displaying any rectangle. could any one help me out to draw a rectangle in scene?

Gajini
  • 413
  • 1
  • 5
  • 21

1 Answers1

1

Check out the example file for drawing primitives. You can see an example of drawing a arbitrary polygon there:

// closed purple poly
gl.glColor4f(1.0f, 0.0f, 1.0f, 1.0f);
gl.glLineWidth(2);
CCPoint vertices2[] = {CCPoint.ccp(30, 130), CCPoint.ccp(30, 230), CCPoint.ccp(50, 200)};
Primitives.drawPoly(gl, vertices2, 3, true);

Just define your rectangle points there.

There are a lot more test examples to be found there that can answer the basic drawing questions like this.

House
  • 3,356
  • 2
  • 25
  • 29