Setting Up Cocos2d for Blackberry 10 Development

Be Sociable, Share!

Untitled-9

Note: Below post works very well as of August 2013 with version Cocos2d-x-2.1.4 . In subsequent releases, things might change, but this article should be a good starting point.

The Cocos2d project also supports blackberry 10 and here are a few steps in setting up your Cocos2D project in the BB10 Momentics IDE

  1. Ensure you have your blackberry Momentics IDE up and running for blackberry 10 app development. This includes getting code signing keys from Blackberry, downloading the IDE, installing your simulator or setting up your bb10 device for direct testing.
  2. Download the Cocos2dx project from http://www.cocos2d-x.org/ . This folder contains the cocos2d main libraries , sample code, and platform specific libraries for different platforms (web, desktop, iphone, android, blackberry).
    The next task is to import  the cocos2d libraries required for blackberry
    development into the Momentics IDE and successfully build the first project.
  3. A quick search of the Cocos2dx source directory reveals a list of proj.blackberry files which indicate blackberry related projects that could be imported.  I found that importing the following proj.blackberry files into my workspace were sufficient to help me build the sample project included .
    • - /cocos2d-x-2.1.4/cocos2dx/proj.blackberry
    • - /cocos2d-x-2.1.4/CocosDenshion/proj.blackberry
    • - /cocos2d-x-2.1.4/extensions/proj.blackberry
      Note that the main reasons for importing the projects above it to make them
      available as referenced projects to your libraries. This pretty much should
      handle errors of missing files or paths etc.
    • /cocos2d-x-2.1.4/template/proj.blackberry
      (This is the sample project which we will run and compile – BBTemplateProject)
  4. To import each  of the above
    File > Import > Existing Project into Workspace > Cocos2dx source directory above
  5. At this point you should have the BBTemplateProject imported. Now try to build it..
  6. I ran into a couple of errors and I used simple fixes (not the best, but I got it to work finally).
    Undefined call to functions WebPInitDecoderConfig and WePDecode in file cocos2dx/platform/CCImageCommonWebp.cpp . Solved it by commenting out the offending lines …
    // if (WebPInitDecoderConfig(&config) == 0) break;
    ...
    ...
    
     /*if (WebPDecode((uint8_t*)pData, nDataLen, &config) != VP8_STATUS_OK)
            {
                delete []m_pData;
                m_pData = NULL;
                break;
            }*/
    
  7. cocos2dx/platform/third_party/blackberry/include/libwebpdecode.h errors . Commented out the lines
    /*static WEBP_INLINE int WebPInitDecoderConfig(WebPDecoderConfig* config) {
     // return WebPInitDecoderConfigInternal(config, WEBP_DECODER_ABI_VERSION);
    }*/
    
    //return WebPGetFeaturesInternal(data, data_size, features,   WEBP_DECODER_ABI_VERSION);
    
  8. Fixing the above errors enabled my BBTemplateProject build successfully, and this is what the result should look like.

    IMG_00000204
  9. Hopefully, it has worked for you too and you can start building cocos2d games on bb10 or porting your existing apps. If you are still having issues, I have also read that updating to the latest BB10 SDK solves some issues.
    Feel free to ask questions or share your experience in the comments below. Good luck!!
    Some cocos2d coding tutorial for blackberry coming soon.
Be Sociable, Share!

About Vykthur

Mobile and Web App Developer and Researcher. Passionate about learning, teaching, and recently - writing.
This entry was posted in Blackberry Tutorials and tagged , , , , . Bookmark the permalink.
  • Pingback: Summary of Blackberry Jam Asia Pre-Conference Training – Gaming Destination | Denvycom()

  • P.K.S

    i did All The Setups Also configure the deployment And I Connected the device (blackberry z10 ), i Build my project putting on Device -Release mode its Build Completely But .bar file is not generating i am using Cocos2dx 2.1.4 And Momentics IDE, Can u tell me The Steps Where I Am Lagging,
    Regars:
    P.K.S

  • Jerónimo Barraco M.

    I had the same problem with the webp library but i have no idea why. it works on my machine with linux but on windows it kept failing so i had to comment them out…