I want to create a circle like in picture below in Android andengine. It should have body by box2d. How can I create it?
質問する
1194 次
2 に答える
2
Since the provided answers are completely irrelevant to the actually asked question, here the actual answer:
You can simply attach a Text entity to a Sprite that shows a circle.
Or have a look at the BitmapTextureAtlasSourceDecorators: https://github.com/nicolasgramlich/AndEngine/tree/GLES2/src/org/andengine/opengl/texture/atlas/bitmap/source/decorator .
- This Example will be particularly helpful: https://github.com/nicolasgramlich/AndEngineExamples/blob/GLES2/src/org/andengine/examples/CanvasTextureCompositingExample.java
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 に答える