嗨,我正在使用 cocos2d 做一个应用程序,这里我需要显示编辑文本。我很容易显示图像和文本视图,但我不知道如何显示编辑文本。如果有人对 cocos2d 中的 edittext 有任何想法,请建议我...使用下面的代码我显示图像..
HelloWorldLayer:
public class HelloWorldLayer extends CCColorLayer {
static HelloWorldLayer layer;
CGSize winSize;
CCSprite home,target;
protected HelloWorldLayer(ccColor4B color) {
super(color);
// TODO Auto-generated constructor stub
winSize = CCDirector.sharedDirector().displaySize();
this.setIsTouchEnabled(true);
home= CCSprite.sprite("banana.png");
home.setPosition(winSize.width/2,winSize.height/2);
this.addChild(home);
}
public static CCScene scene() {
// TODO Auto-generated method stub
//Creates scene
CCScene scene = CCScene.node();
layer = new HelloWorldLayer(ccColor4B.ccc4(225, 225,225, 225));
//adds layer to scene
scene.addChild(layer);
return scene;
}
@Override
public boolean ccTouchesEnded(MotionEvent event)
{
CGPoint location = CCDirector.sharedDirector().convertToGL(CGPoint.ccp(event.getX(), event.getY()));
if (CGRect.containsPoint(home.getBoundingBox(), location))
{
CCDirector.sharedDirector().replaceScene(CCFadeTransition.transition(0.5f,GamestartLayer.scene()));
removeAllChildren(true);
}
return true;
}
}