@leavemealone 写道:
我想创建一个CCEAGLEView 作为ios下一个UIView的子节点 ,单独的加了一个场景是黑色的,我想让它是透明的 这样ios上的父节点的图才能被看见,代码如下,应该怎么改
CCEAGLView *eaglView = [CCEAGLView viewWithFrame: [UIScreen mainScreen].bounds pixelFormat: (__bridge NSString *)cocos2d::GLViewImpl::_pixelFormat depthFormat: cocos2d::GLViewImpl::_depthFormat preserveBackbuffer: NO sharegroup: nil multiSampling: NO numberOfSamples: 0 ]; // Enable or disable multiple touches [eaglView setMultipleTouchEnabled:NO]; eaglView.opaque = NO; eaglView.backgroundColor = [UIColor clearColor]; UIView* pview = (UIView*)parent; [pview insertSubview:eaglView atIndex:1]; // Set EAGLView as view of RootViewController cocos2d::GLView *glview = cocos2d::GLViewImpl::createWithEAGLView((__bridge void *)eaglView); //set the GLView as OpenGLView of the Director cocos2d::Director::getInstance()->setOpenGLView(glview); Application::getInstance()->run(); auto s = cocos2d::Director::getInstance()->getWinSize(); cocos2d::Scene* scene = cocos2d::Scene::create(); Director::getInstance()->runWithScene(scene);
帖子: 3
参与者: 1