Quantcast
Channel: Cocos中文社区 - 最新主题
Viewing all articles
Browse latest Browse all 88737

3.13.1创建的scene是黑色 只有scene的时候不应该是透明的吗

$
0
0

@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

阅读整个主题


Viewing all articles
Browse latest Browse all 88737

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>