Search code examples
c++11cocos2d-xcocos2d-x-3.0

How to use CCDirector and other changes in COCOS2D 3.0?


I have to convert my game into new version of cocos2dx.

I have finished to conversion but got deprecated the followings.

 COCOS2DX-2.X                            COCOS2DX-3.X

 sharedDirector()->getWinSize()              -> ?

 SpriteFrameCache::sharedSpriteFrameCache()  -> ?

  glVertexAttribPointer(kCCVertexAttrib_Position, 2, GL_FLOAT, GL_FALSE, 0, glVertices);

 kCCVertexAttrib_Position                    -> ?

Can any one assist me to convert?

Thanks in advance.


Solution

  • Here the solutions

     Size screenSize =  Director::getInstance()->getWinSize();   - No need sharedDirector()
    
     SpriteFrameCache::getInstance()->addSpriteFramesWithFile("example.plist"); - No need sharedSpriteFrameCache
     glVertexAttribPointer(GLProgram::VERTEX_ATTRIB_POSITION, 2, GL_FLOAT, GL_FALSE, 0, vertices);   - No need kCCVertexAttrib_Position
    

    This will help for your conversion.