Windows 8 DirectX and XAML

I am going insane here, searching for a similar answer…
I have a game done using Cocos2dx-2.1.0-wp8-2.0-alpha.zip, and I need to put it on Windows Phone 8, using a DirectX + XAML + D3DInterop, because I want to add LiveTiles to it.

So… I am just as eager to see a decent answer here, or a new Cocos2dx WindowsPhone8 release, since 2.1.0 seems a bit outdated :slight_smile:

Hello,

has anybody made progress on DirectX + Xaml + Cocos2d-x for Windows Phone? I am trying to get this working now for a couple of days. I am eager to work together on a solution and change ideas.

Cheers
Tom

Sorry, no. I’ve given up for now on Windows Phone (my app is live in the market, but without ads and/or any other xaml elements). I guess I’ll have to wait until Microsoft finally integrates the Windows RT and the Windows Phone API’s. For now I’ll just have to earn my money with iOS and Android (I make more in one day on iOS than I make in three months on Windows Phone, so it’s just not worth the time and effort).

I finally found a solution to this problem by using Cocos2d-XNA with MonoGame.
now i can use all windows phone 8 features in my game just like any other app.
I tried a lot in cocos2dX but the results were not satisfying.

Pink Nibor… actually Microsoft got more involved in Cocos2d-x.
Look at there links:

As for XAML, you could do that yourself using the 2.1.0alpha port and the XAML-Interop component template.
By the way, you can’t use SwapChainBackground on WP8, it has some zOrder issues.

After some messing around with those templates, I got the game working on Windows Phone, with all the WP8 functionality.

Hello,

thanks for all the responses:

  • @ Pink Nibor: leaving out the ads may be a short term option but I need them for future projects. So it is only an option if I can be absolutely sure it will all work in a couple of months.
  • @ Mohamed Adly: cocos2d-xna would only be a backup solution. I have it working on another game with cocos2d-xna but I am not very happy with the framework. Performance seems to be a lot slower, sounds do not work great if played multiple at the same time and there are some components that do not work well. (I was using the master branch so that could have been part of the problem :slight_smile: )
  • @ Blood Art: thanks for the information. Using the alpha release would probably be better than go with the Cocos2D-xna framework. Can you share a little more how exactly you have done it. Was it necessary to change the cocos2d-x framework?

Cheers
Tom

Yes, you need to short-circuit the logic. Put your draw(), update() etc. calls into the CubeRender demo class from the XAML component template. Also, in the UpdateDevice call, you need to take the DirectX stuff and pass it as int address to your game (don’t do any rendering initializations in your game, the XAML-interop template does it by default).

In order to create/update LiveTiles, you need to trigger an interop event from your game code (maybe set some global values somewhere, which you can access from c# and write them on the live tile, and do the actual live tile update from the C# component)

PS: instead of SwapChainPanel, you need to use DrawingSurfaceGrid. You won’t find that in the default VS2012/VS2013 templates, you need to search a bit.

It seems that MS OpenTech does have a WP8-XAML branch. I am first going to test this one

https://github.com/MSOpenTech/cocos2d-x/tree/wp8-xaml

Cheers
Tom

Be careful with that. As far as I know, it’s still under development.