LoginSignup
4
5

More than 5 years have passed since last update.

GLViewにcreateが無くなった(cocos2d-x v3.3 rc0)

Last updated at Posted at 2014-11-11

AppDelegateのapplicationDidiFinishLaunching()にて、
GLViewをcreateして〜設定をゴニョゴニョして〜とすることが多いかと思いますが、
cocos2d-x v3.3から、GLViewにてcreateが無くなってしまっていて、v3.2系以前で作っていたソースだとエラーが出るのでメモ
(一応、この記事を書いた時点ではv3.3RC0版です)

たぶん今まではこんな感じで書いてるはず

sample
bool AppDelegate::applicationDidFinishLaunching() 
{
    auto director = Director::getInstance();
    auto glview = director->getOpenGLView();

    if(!glview) {
        glview = GLView::create("hogehoge");
        director->setOpenGLView(glview);
    }

    //~~~以下省略~~~~

    return true;
}

ただ、それだと、GLView::create("hogehoge");でエラーが出るので、
こんな感じにします。

sample
bool AppDelegate::applicationDidFinishLaunching() {

    auto director = Director::getInstance();
    auto glview = director->getOpenGLView();
    if(!glview) {
        glview = GLViewImpl::create("My Game");
        director->setOpenGLView(glview);
    }

    //~~~以下省略~~~~

    return true;
}

GLViewImplになったんですね。

githubを見るとコメントを添えて直してるのがわかります。
https://github.com/cocos2d/cocos2d-x/issues/8546

まーちょいと調べりゃ分かるもんですけどとりあえずメモメモ

4
5
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
4
5