ControlSwitch *switchControl = ControlSwitch::create
(
Sprite::create("extensions/switch-mask.png"),
Sprite::create("extensions/switch-on.png"),
Sprite::create("extensions/switch-off.png"),
Sprite::create("extensions/switch-thumb.png"),
Label::createWithTTF("On", "fonts/Marker Felt.ttf", 16),
Label::createWithTTF("Off", "fonts/Marker Felt.ttf", 16)
);
auto l = Node::create();
l->addChild(switchControl);
l->setContentSize(Size(80, 0));
l->setPosition(Point(100, 100));
addChild(l);
在proj.android\src\org\cocos2dx\lib下的Cocos2dxActivity.java中修改函數:
public Cocos2dxGLSurfaceView onCreateView() {
Cocos2dxGLSurfaceView glSurfaceView = new Cocos2dxGLSurfaceView(this);
// TestCpp should create stencil buffer
glSurfaceView.setEGLConfigChooser(5, 6, 5, 0, 16, 8);
return glSurfaceView;
}
ok,可以編譯了。