0

I want to create a circle like in picture below in Android andengine. It should have body by box2d. How can I create it?

a busy cat

4

2 に答える 2

2

Since the provided answers are completely irrelevant to the actually asked question, here the actual answer:

  1. You can simply attach a Text entity to a Sprite that shows a circle.

  2. Or have a look at the BitmapTextureAtlasSourceDecorators: https://github.com/nicolasgramlich/AndEngine/tree/GLES2/src/org/andengine/opengl/texture/atlas/bitmap/source/decorator .

Regarding creating a body from an Entity, have a look here: https://github.com/nicolasgramlich/AndEngineExamples/blob/GLES2/src/org/andengine/examples/PhysicsExample.java#L179

于 2012-04-27T16:19:50.253 に答える
-1

Try this solution:

    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        setContentView(demoview);
    }

    private class DemoView extends View{
        public DemoView(Context context){
            super(context);
        }

        @Override
        protected void onDraw(Canvas canvas) {
            super.onDraw(canvas);
            Paint p = new Paint();
            p.setColor(Color.RED);
            DashPathEffect dashPath = new DashPathEffect(new float[]{5,5}, (float)1.0);

            p.setPathEffect(dashPath);
            p.setStyle(Style.STROKE);
            canvas.drawCircle(100, 100, 50, p);
            Paint pp = new Paint();
            pp.setColor(Color.BLUE);
            canvas.drawText("kadir", 100, 100, pp);    
            invalidate();
        }
    }
}
于 2012-04-22T07:52:49.377 に答える