0
嗨,如何在Android中添加UISLIDER的Cocos2D
我在這裏做一個應用程序,我在使用的Android做的cocos2d的小遊戲。我需要顯示uislide,但我不知道如何顯示。我嘗試過,但我沒有任何想法,我正在做代碼下面的應用程序,如我動態採用surfaceview請任何人建議我如何顯示滑塊,以及如何將圖像瀏覽,textviews到XML文件。
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;
}
}
我們可以在GameLayer類中使用EditText嗎? –