[EAGLView sharedEGLView] - what should use in cocos2d-x 3.0 rc0 instead?
Thank you so much!
[EAGLView sharedEGLView] - what should use in cocos2d-x 3.0 rc0 instead?
Thank you so much!
auto director = Director::getInstance();
auto glview = director->getOpenGLView();
well, I do the same way, but it seemed that it can not turn into UIView.
cocos2d::GLView glview = cocos2d::Director::getInstance()->getOpenGLView();
[(UIView)glview addGestureRecognizer:_recognizerSwipeRight];
it will crash.
Did you ever figure out the problem? I’m seeing the same issue. My code was using [EAGLView sharedEGLView] in cocos2dx 2.2.1, but now that I’m using 3.x I ported the [EAGLView sharedEGLView] to use the approach mentioned in this thread.
When I try added a UIImageView (mWheelFrame) as shown below I get an EXC_BAD_ACCESS error inside the lookUpImOrForward call:
[glview addSubview:mWheelFrame];
cocos2d::GLView *glview = cocos2d::Director::getInstance()->getOpenGLView();
if (glview)
{
CCEAGLView *eaglview = (CCEAGLView*) glview->getEAGLView();
if (eaglview)
{
// your code
}
}