Cocos2d-x for wp8 v2.0 preview

By walzer Posted 2013-03-27 07:46 Comments 85

Today we released the v2.0 version of Cocos2d-x for Windows Phone 8. Note that it is the first version for wp8 which has v2.x API set migrated. We would like to thank Microsoft and Nokia for their support.

Download link:
Github repo:\_v2

This branch of Cocos2d-x uses Direct X 11 for rendering while still uses C++ to program, with the same API as Cocos2d-x v2.1.

There are already many games in the pipeline and scheduled to be available soon in Windows Phone Store, using Cocos2d-x WP8 2.0.

We look forward to hearing feedback from developers, and for those at the Game Developer Conference in San Francisco, come and visit us at booth 412.


  • Wriggler

    Excellent work, thank you all! I’ve been looking forward to this one. Thanks again.

    2013-03-27 10:21
  • pekayatt

    It is working here, I will try to port my game today :D

    2013-03-27 13:26
  • jandujar

    good work[]()

    now integrate it to the cocos2d-js binding and make me happy. ;)

    2013-03-27 15:18
  • jeffersonpita


    Is there a way to use webservices with cocos2d-x for wp8?

    2013-03-27 17:00
  • Konrad

    Hello, I checked this yesterday and it looks not to be as stable as first version (cocos2dx-0.13.0-wp8-0.8).

    Crash in:
    1. MenuTest > Closes application
    2. Pressing on close button in top right corner
    > Throws exceptions
    3. SpriteTest, works only in 2 cases, produces > Unhandled exception at 0x71538F86 in TestCpp.exe: 0xC0000005: Access violation reading location 0x00000018.
    4. When I try to create simple Sprite animation from my .plist, it crashes on update object:
    void CCObject::retain
    CCAssert; // <—

    When I retain almost everything, then it is not crashing, but nothing is displayed on screen instead.

    I’d like to mention that all above is working in previous version of cocos2d-x wp8 (cocos2dx-0.13.0-wp8-0.8).

    2013-03-28 06:48
  • hrust

    It also would be nice to update win8 metro branch))

    2013-03-28 09:57
  • eric2013

    Hi, I just installed this version.
    1. Works in simulator but did not display anything on real device.
    2. CCLabelBMFont ->getContentSizeInPixel return incorrect size

    The above all works in cocos2dx-0.13.0-wp8-0.8.

    2013-03-29 00:36
  • ZhiShuo

    wait a long time . thanks !

    2013-03-29 09:12
  • saudahmed

    When are you going to add support for CocosBuilder , CCScrollView, CCTableView and other GUI extensions in this branch.

    2013-04-02 08:18
  • Billy_Lavoie

    Does this mean we could see an updated build for Windows8 too soon? :)

    2013-04-02 21:17

    Well, this is a good news[]()
    But the rendering implement is old. I think this version can’t work well :(

    2013-04-03 07:35
  • munir

    Great news!

    When can we expect v2 port for Windows 8?

    2013-04-03 17:18
  • vradgames_hotmail_co

    So, to confirm, can I port my Game developed using this Version to WP8, Android, IPhone and Blackberry?

    2013-04-04 05:59
  • eric2013

    This version is not working in real device. I am using Lumia 620, display shows blank when deployed to real device. Simulator works ok. Cocos2d-x team please post a tutorial to show how to work with real device, thanks.

    2013-04-04 08:11
  • pekayatt

    @Eric Hung
    You should change the deploy to ARM and not x86! (That only works in the emulator)

    I got the last version on Git (that got an update couple of days ago) and it almost working, some stuff as particles and transition effects are broken, but give some time to the guys, I know they are working on it!

    Good work guys!

    2013-04-04 17:19
  • eric2013

    @ Pedro Kayatt
    Thanks for your information. I finally find out what’s wrong.
    I download v2 from Git.
    1. Compile as Simulator, all working.
    2. Compile as Device~~>Release~~>ARM, HelloWorld, HelloWorldBox, TestCpp, all compile ok, install ok on Lumia 620, all with blank screen.
    3. Compile as Device~~>Debug~~>ARM, everything works ok on Lumia 620.
    Hope cocos2d-x team will fix this too. Thank you cocos2d-x team.

    2013-04-06 10:30
  • pinky2012

    I’ve ported my App finally to WP8; you guys rock. Thanks!

    2013-04-07 20:36
  • pinky2012

    .. just one request. It would be great if you can make an XAML hybrid version (on Win8 I managed to create an interop app on my own, but I’m afraid on WP8 that’s a bit harder).

    There are still bugs in this version that I had to fix to get it functioning:

    • Reading a string from CCDefaults that does not exist yet results in a crash;
    • Using a space in a label (ttf and BM) results in a crash;
    • I had to incorporate a delegate in CCApplication for the back button (which is a must have to get approved for the store);
    • I had to add code to show the onscreen keyboard on attach with IME;
    • It appears that some touch functions do not account for the actual device orientation (touch points as if the device is in portrait whilst is actually in landscape);

    On other platforms a libcurl lib is included. Would it be an idea to abstract and include the HTTPRequest sample from Microsoft into this project as a suitable libcurl replacement ?

    2013-04-07 20:52
  • jcclarke

    Is word wrapping not currently implemented? Can’t get paragraphs to word wrap using CCLabelTTF.

    2013-04-08 22:54
  • eric2013

    @Pink Nibor
    Can you share the code on

    1. how to incorporate a delegate in CCApplication for the back button ?
    2. how to show the onscreen keyboard on attach with IME ?

    That helps WP8 cocos2d-x developer a lot, thanks.

    2013-04-13 00:12
  • pinky2012

    Difficult to explain

    2013-04-13 12:00
  • pinky2012

    You can download the modified files I use on Replace with these files and the keyboard should just work (there is a new function in DirectXRenderer called ToggleKeyboard(bool visible))

    As for the backbutton: implement the BackbuttonDelegate in your scene like this:

    class GameLayer : public cocos2d::CCLayerColor , public CCTextFieldDelegate, public KSDialogInputDelegate, public GCDelegate, public KSDialogDelegate , public BackbuttonDelegate

    And add the delegate function:

    bool GameLayer::onBackPressed(bool result)
    if (ActiveAlert == 0)
    return true;

    If you want the App to close return False. If you handled the backbutton action within your app, return FALSE.

    Only problem I still have that if I specify the NDEBUG preprocessor directive, the screen stays black (both on simulator and on device).

    2013-04-13 12:07
  • pinky2012

    Sorry typo: return true if you do not want the app to close ;-)

    2013-04-13 12:09
  • eric2013

    Thanks Pink Nibor.

    I am stuck at :

    bool CCApplication::onBackButton()
    bool ff = true;
    if (m_pDelegate) ff=m_pDelegate->onBackPressed(false);
    return ff;

    m_pDelegate is always null. How to set pDelegate ?

    2013-04-14 05:04
  • pinky2012



    2013-04-14 07:24
  • kimiazhu

    the samples work fine on my Huawei device. :)

    2013-04-14 11:58
  • Vladimir_BL

    I’m making big project for WP8 using Cocos.
    I’ve fixed 2 serious bugs:
    File CCActionInterval.cpp
    Method void CCAnimate::update(float time)

    void CCAnimate::update(float time)
        CCArray *pFrames = m_pAnimation->getFrames();
        unsigned int numberOfFrames = pFrames->count();
        unsigned int idx = (unsigned int)(time * numberOfFrames);
        if (idx >= numberOfFrames)
            idx = numberOfFrames - 1;
        // NEED FIX.Here is Cocos bug: pFrames->objectAtIndex(idx) returns CCAnimationFrame but not CCSpriteFrame
        CCSprite *pSprite = (CCSprite*)(m_pTarget);
        // NEED FIX+
        CCAnimationFrame* aniFrame = (CCAnimationFrame*)(pFrames->objectAtIndex(idx));
        CCSpriteFrame* frame = aniFrame->getSpriteFrame();
        /*if (! pSprite->isFrameDisplayed((CCSpriteFrame*)pFrames->objectAtIndex(idx)))
        if (! pSprite->isFrameDisplayed(frame))
        // NEED FIX-

    File CCLayer.cpp
    Constructor of CCLayerColor: 2 arrays were not initialized

    /// ColorLayer
    CCDXLayerColor CCLayerColor::mDXLayerColor;
    : m_cOpacity(0)
    , m_tColor( ccc3(0,0,0) )
        // default blend function
        m_tBlendFunc.src = CC_BLEND_SRC;
        m_tBlendFunc.dst = CC_BLEND_DST;
        // NEEDED FIX+
        for (unsigned int i=0; i

    Also I was forced to implement HTTPRequest instead of “curl” and use std::thread instead of “pthread”. Also I was forced to comment some CCAsserts.

    Do you have plans when will new WP8 version of cocos be released?

    2013-04-18 13:57
  • pinky2012

    Submission of a release build to Microsoft results in an error:

    The application cannot be tested for compliance for Windows Phone Application Certification Requirements due to geographic, hardware, and/or software limitation. The application cannot be found from the application list or from the game hub after installation.

    It’s obvious the App does show up on my device when testing (either debug or release version)…

    Any ideas?

    2013-04-18 17:46

    don’t working in real device.
    because CCTexture2D.cpp ln551 :
    CCAssert(this~~>initWithData, “Create texture failed!”);
    in release, #define assert 0)
    so this~~>initWithData() is not be activity.

    2013-04-19 08:40
  • pinky2012

    The application cannot be tested for compliance for Windows Phone Application Certification Requirements due to geographic, hardware, and/or software limitation. The application cannot be found from the application list or from the game hub after installation.

    Occurs when you set the App type to Game. Can be solved by adding an AppManifest.xaml and a dummy DLL. After that your game will show up in the Game Hub (and not in the App list).

    2013-04-19 16:28
  • eric2013

    This alpha release is not being updated for over a month. I appreciate the hard work of the team. Thanks. Would the team accelerate to stable release as soon as possible. We would like to release the potential of WP8.

    2013-04-21 10:22
  • saudahmed

    I am trying to add inApp purchase for my game for cocos2dx-wp8-v2.0. I have gone through the api but I am not able to call methods in C# from the Visual C++ in my code. Has anybody implemented the inApp purchase. Help will be appreciated.

    2013-04-25 07:01
  • saudahmed

    I am trying to submit my app as beta for inApp purchase testing but When upload the release build after validation it gives me this error

    1028: The native API api-ms-win-core-debug-l1-1-1.dll:OutputDebugStringA() isn’t allowed in assembly Cocos2dWindowsPhone.dll. Update it and then try again

    How were you able to submit your app. What necessary changes you made to submit your app?

    2013-04-26 12:36
  • pinky2012

    It’s in CCfileutils and is just for debugging (search the solution for OutputDebugString and you’ll find it soon enough). Just comment out the line or replace it with CCLog

    My App passed certification today with the 2.0 Alpha framework :)

    2013-04-27 01:39
  • eric2013

    Summary of workaround to publish app to market:

    comment out the line with OutputDebugStringA

    CCAssert(this~~>initWithData, “Create texture failed!”);
    this~~>initWithData(data, pixelFormat, POTWide, POTHigh, imageSize);

    1. Compile to Device~~>release~~>ARM

    Your app should pass then.

    2013-05-01 01:47
  • elanser

    Hello community! :)
    Some bugs which don’t allow to issue the final version of game:

    1 - after some time data in CCUserDefaults, an error 24 too many open files cease to remain… Here:
    tintxml.cpp module, function: bool TiXmlDocument::SaveFile(const wchar_t* filename) const, line: errno_t err = _wfopen_s( &fp, filename, L“w” ); <— err=24

    2 - at each level in my game, on the screen, time in seconds is drawn. I use, for example: timettf = CCLabelTTF:: create (“0”, myconst~~>fontName, sizefnt);
    after some time in the console was out that the font isn’t found and the sizes of letters become huge. This problem managed to be solved
    3~~ In my game I use CCSpriteBatch, at each level new textures are loaded, and old are cleared. On level end I clear a cache
    CCTextureCache::sharedTextureCache ()->purgeSharedTextureCache();
    But all the same, after loading of 5-6 levels of texture cease to be created and the program crash here:
    CCTexture2D.cpp module, function: bool CCTexture2D:: initWithData, line: if (FAILED (pdevice->CreateTexture2D (both tdesc, and tbsd, &tex)))

    All this doesn’t allow to port the game version for wp8
    What it is possible to undertake for elimination of these bugs?

    2013-05-12 03:50
  • Vladimir_BL

    Most probably all problems with opening files (“too many open files”?) is because of incorrect using FT_New_Face inside of bool FTTextPainter::SetFont.
    FT_New_Face should be called once for each font (to create it). In current alpha release it is called on EVERY frame for any font. You should make light fixes to use already created fonts instead of creating them at each new frame.

    2013-05-13 05:38
  • elanser

    Thanks :) Vladimir.
    I will fix this bug and will showing fixed code….

    2013-05-13 12:41
  • Sentiz

    Hello Community.. I want to use ccprogressTimer in my wp8 game. I have used ccprogresstimer in ios and android projects, its working fine there. But in WP8 it is not displaying and its not crashing also. Can anyone put example here..??

    2013-05-23 07:45
  • Vladimir_BL

    About CCProgressTimer:
    In Android and iOS versions there is “kCCProgressTimerTypeBar”. But in WP8 it is not used. You should specify one of new type: kCCProgressTimerTypeRadialCCW, kCCProgressTimerTypeHorizontalBarLR, etc…

    2013-05-23 07:54
  • Sentiz

    Currently WP8 Cocos2dx 2.0 is not supporting for ExcatFit or NoBorder options while setting design resoultion. So will it be added in update version ?

    2013-05-23 09:42
  • jacob_m99

    so I’m now stuck with the back button..
    I updated the CCApplication .cpp and CCApplication .h but now my question is how do I use it in my scene.

    I got the hello world example up and running with the back button implementation. how would I check on helloworldscene to see if the back button as been pressed.?
    now from what I understood if I wanted my app to close all I have to do is return false. if I wanted it not to close, for instance return to a previous scene I turn true and replace scene with whatever previous scene I want..

    2013-06-20 12:25
  • Jasim9

    Hello Pink Nibor,

    I used your files for the back button implementation. But it is not working DirectXRender has many errors like
    Error 31 error C2039: ‘OnKeyDown’ : is not a member of ‘cocos2d::DirectXRender’

    Please help me out. I only want the back button functionality to transition to a specific scene I want.


    2013-07-16 07:31
  • pinky2012

    You should add those new methods to the include file (DirectXRender.h):


    void OnKeyDown(
    _In_ Windows::UI::Core::CoreWindow^ sender,
    _In_ Windows::UI::Core::KeyEventArgs^ args

    and add:

    @ void ToggleKeyboard(bool status);@

    That should be it.

    2013-07-17 20:03
  • pinky2012

    To use the backbuttondelegate:

    1) add the delegate to your scenes include file:

    `class HelloWorld : public cocos2d::CCLayer, public BackbuttonDelegate


    virtual bool onBackPressed(bool result);`

    Implement that function in your scene:

    `bool HelloWorld::onBackPressed(bool result)

    return false; // if you want your game to exit

    do something and return true if you want your game not to exit but switch scene's.


    2013-07-17 20:08
  • pinky2012

    Has anyone come up with a solution to mingle XAML and Cocos2d-x on WP8 (so we can use ads, facebook, webviews etc.). It should be possible but I can’t get it to work.

    2013-07-17 20:11
  • jacob_m99

    thanks for the backbuttondelegate help

    I followed your instruction and it seams to not get the false when I want it to close the application.
    on the scene I added the fuction
    bool helloworld::onBackPressed(bool result) {
    return false;

    I figured it out all the way to
    @bool CCApplication::onBacButton()
    bool ff = true;
    if (m_pDelegate)
    return ff;
    it looks to me that m_pDelegate is always null so it never gets to run
    so then ff is always true since its set to true on the first line.

    on an earlier post it said something about


    where would that go.?

    2013-07-24 19:02
  • muhammadsaad

    I am facing a problem with custom fonts. when i add a font it gets a reddish color. i have no idea what the problem is. this is how im doing it
    scoreText = CCLabelTTF::create((scoreValue).c_str(), “BlackBoard.ttf”, 20);
    this~~>addChild(scoreText, 3);

    Any help?

    2013-08-06 06:40
  • kirjushyk

    Hi, Muhammad Saad.

    I faced the same proble when ported my game to WP8.
    I solved it by changing

    unsigned char pixelValNew[PIXEL_WIDTH] = { 255, pix, pix, pix };


    unsigned char pixelValNew[PIXEL_WIDTH] = { pix, pix, pix, pix };

    in platform\win8_metro\FTTextPainter.cpp

    2013-09-24 11:46
  • kirjushyk

    Abadoned? Any news? I wanna update :) Hey, fellows, let’s continue work on WP8. I can help.

    2013-09-30 10:51
  • saudahmed

    Hi Kyrylo Polezhaiev,

    I want to open a link to internet explorer on windows phone 8 from within my app. I also want to open an email composer. These api’s are available in native C-sharp. There is a concept like launchers. But on Visual C++ side this functionality is not available in Windows api. I have done these for my windows 8 app but these set of apis have not been implemented for windows phone8. Any work around?

    2013-10-01 09:17
  • saudahmed

    Anybody has an idea how to call applicationdidenterbackground and applicationdidenterforeground of Appdelegate. Uptill now this is not being evoked when app goes to homescreen and returns back from home screen.

    2013-10-01 10:05
  • Vladimir_BL

    To launch IE from WP8 native application I use:
    static std::wstring stows(const std::string& s)
    std::wstring ws;
    ws.assign(s.begin(), s.end());
    return ws;
    void appOpenURL(const char *url)
    // Create a Uri object from a URI string
    auto uri = ref new Windows::Foundation::Uri(ref new Platform::String(stows(url).c_str()));
    // Launch the URI
    catch (…)

    2013-10-01 11:48
  • elanser

    Hello community! :)
    This is the last version cocos2d-x 2.x for wp8:

    2013-10-12 02:51
  • james12

    I want you to thank for your time of this wonderful read!!! I definately enjoy every little bit of it and I have you bookmarked to check out new stuff of your blog a must read blog!!
    rely with essay writing on this service

    2015-04-09 14:15
  • william123

    We stand behind our products quality and ensure that people can use them without any worries

    2015-04-11 14:40
  • blogcommenting21

    Thanks for providing recent updates regarding the concern, I look forward to read more. social media optimization solution

    2015-04-13 05:35
  • blogcommenting21

    I definitely enjoying every little bit of it. It is a great website and nice share. I want to thank you. short summer dresses

    2015-04-13 05:42
  • blogcommenting21

    I am overwhelmed by your post with such a nice topic. buy reverbnation plays

    2015-04-13 05:44
  • blogcommenting21

    Very nice thesis you've put up here. This helped me to achieve full knowledge about this particular topic. best betting sites

    2015-04-13 05:47
  • blogcommenting21

    Do you mind updating your blog post with additional insight? It should be really useful for all of us. website design westchester ny

    2015-04-13 05:50
  • blogcommenting21

    It’s so remarkable that I can't afford to not go through this valuable information whenever I surf the internet! LedConceptsLighting

    2015-04-13 05:52
  • blogcommenting21

    Great info! I recently came across your blog and have been reading along. I thought I would leave my first comment. I don’t know what to say except that I have. limousine & airport car service

    2015-04-13 05:58
  • blogcommenting21

    i read a lot of stuff and i found that the way of writing to clearifing that exactly want to say was very good so i am impressed and ilike to come again in future.. get more information

    2015-04-13 06:02
  • blogcommenting21

    I am glad you take pride in what you write. This makes you stand way out from many other writers that push poorly written content.

    2015-04-13 06:12
  • blogcommenting21

    Hope you continue to share more of your ideas.I will definitely love to read. voucher lazada

    2015-04-13 06:15
  • blogcommenting21

    What you're saying is completely true. I know that everybody must say the same thing, but I just think that you put it in a way that everyone can understand. moving helpers

    2015-04-13 06:18
  • blogcommenting21

    Great info! I recently came across your blog and have been reading along. I thought I would leave my first comment. I don’t know what to say except that I have. Roof washing Tallahassee

    2015-04-13 06:23
  • blogcommenting21

    I was very interested in the article, it's quite inspiring I should admit. followfy

    2015-04-13 06:42
  • blogcommenting21

    Great article. Thanks for sharing folks. THANK YOU!! AMAZING!!!!!!Wow, superb blog format! How long have you been running a blog for? FABOULOUS !!!!!! DripFollowers

    2015-04-13 06:48
  • blogcommenting21

    I like the way you explained the difficult topic with such details. Find Out More

    2015-04-13 06:53
  • blogcommenting21

    There is no doubt that the power of music turns an event into a memory. Have you ever stopped to consider how the use of music alters our mood, whether from one of joy to sadness or satire to drama in an instant. hookup to get laid

    2015-04-13 06:57
  • blogcommenting21

    This is just the information I am finding everywhere. Thanks for your blog, I just subscribe your blog. mp3 songs

    2015-04-13 07:02
  • blogcommenting21

    This is one great result after checking through the net and meeting suggestions just like you've provided. chicken coop

    2015-04-13 07:09
  • blogcommenting21

    Thanks for taking the time to discuss this, I feel strongly about it and love learning more on this topic. this page

    2015-04-13 07:14
  • blogcommenting21

    Writing only comments will close the discussion straight away! And will restrict the benefits from this information. Wireless Baby Monitors

    2015-04-13 07:20
  • blogcommenting21

    This blog contains so many interesting stuff that makes me want to visit again and again. Look forward for more interesting updates have a peek here

    2015-04-13 07:28
  • japancomp234

    Pretty good post. I just stumbled upon your blog and wanted to say that I have really enjoyed reading your blog posts. Any way I'll be subscribing to your feed and I hope you post again soon. Big thanks for the useful info.
    world news

    2015-04-15 10:52
  • blogcommenting21

    Excellent and decent post. I found this much informative, as to what I was exactly searching for. Thanks for such post and please keep it up. ingersoll rand dealers

    2015-04-16 05:48
  • blogcommenting21

    A very nice article this is. I am really happy that you uploaded this helpful post today. Thank you very much! My friends and family members will be happy after hearing about this. online bingo

    2015-04-16 05:57
  • blogcommenting21

    I really like the dear information you offer in your articles. I’m able to bookmark your site and show the kids check out up here generally. B40 Dash Cam Review

    2015-04-16 06:25
  • blogcommenting21

    A very nice article this is. I am really happy that you uploaded this helpful post today. Thank you very much! My friends and family members will be happy after hearing about this.

    2015-04-16 07:02
  • blogcommenting21

    It proved to be Very helpful to me. Thank you so much And I hope that other readers will also experience how I feel after reading your article.

    2015-04-16 07:04
  • blogcommenting21

    A very nice article this is. I am really happy that you uploaded this helpful post today. Thank you very much! My friends and family members will be happy after hearing about this. Leben

    2015-04-16 07:07
  • AsharSeo

    Thanks for sharing this. There are many events which are celebrated all over the world. we have a website about mothers day event so have a look at

    2015-04-20 07:08

Sign up for our newsletter to keep up with the latest developments, releases and updates for Cocos2d-x.