InApp purchase for window phone 8 in cocos2dx

I create plugin-x to call c# function, you can see on branch develop

sdk integration guide is very difficult to understand also looks like incomplete :frowning: can anyone simplify it n post ?

You just would use the API to integrate it as in any Win8 Phone application.
It doesn’t rely on cocos2D-x classes as this is different on every platform.

Take a look:

API Overview:
http://msdn.microsoft.com/en-us/library/windowsphone/develop/jj206950(v=vs.105).aspx

thanks Eschmelax !
Basically my game is cross-platform! and i want to know how to call c# methods from c++ game code. any help over this topic ?

@Anurag: You’re welcome!
But why not write everything in C++? Version 11 is supported in Cocos2D-X V.3.0 also.
Maybe with some Lua on top? That depends of course what you’re up to.
This will save you alot of headache instead of juggling the code between language conversions.

hi Anurag: http://stackoverflow.com/questions/17304386/how-does-one-make-function-calls-or-trigger-events-from-a-native-component-into, it’s how to call c# methods from c++ in the #2.

Just to warn you guys before you try to code like monkeys or I have done.

In the WP8-XAML you will not have direct access to the WP8 IAP… that is because you will need it to run on the UI Thread, that is not that easy :stuck_out_tongue: (teachings: http://robwirving.com/2013/07/17/guide-to-getting-to-the-ui-thread-for-any-type-of-windows-phone-8-app/)

Nevertheless I have changed some code on the file Cocos2DRenderer.cpp and got easy access to the delegate that can call methods of the c# (public void OnCocos2dEvent(Cocos2dEvent theEvent)).
I have studied how this method works I got my own code on it, it is pretty simple and it gives you access to C# methods.

Have been for 2 days this tab open and some tips were great, thx guys!

hi… @pekayatt could you share some code??? thanks :slight_smile:

also … how do i create a xaml project!!!.. i create a new project and i dodnt see a xaml project folder even in 2.2.2???

standart template include wp8-xaml project. You can copy cocos2dxFolder\template\multi-platform-cpp folder to your cocos2dxFolder\projects folder and rename (if you want) projects’files and folders

the newest code in master branch(https://github.com/cocos2d/cocos2d-x/tree/master) have the template of wp8-xaml: , and you can use create_project.py to create. Thanks.

@chenjc i downloaded it this morning and tries … there is no xaml in the template folder. Also, copied the hellocpp.wp8xaml project and pasted in the template folder and I get the above error… phonedirect3dxamlappcomponent.winmd cannot be found…:frowning:

edit: sry i see that the xaml project is in the template in the github… i think i downloaded it the from the site thanks :slight_smile:

@chenjc ok works… the only thing is that i have to download angleproject and put it in the thirdparty directory… in the future release will be rectified so that i can download it off of the site and it would worl right out of the box?

any idea as to when 2.2.3 or 2.2.5d will be release?

thanks for the help :slight_smile:

you have better use github and update submodule while angleproject is a submodule, not directly download. Thanks.

oh ok… i am new to github and cloning… I mean i dont even use it for version control either …i do it the arcade way…

any eta on 2.2.3?

hi… I am trying to integrate the ad from the adcontrol branch, i keep getting this error tho the file still exits in the component.

c:\users\sidsh_000\desktop\cocos2d-x-master\cocos2dx\platform\wp8-xaml\adcontrol\adcontrolevent.h(4): fatal error C1083: Cannot open include file: ‘InputEvent.h’: No such file or directory.

also I am getting this error again :frowning:

Metadata file ‘C:\Users\sidsh_000\Desktop\cocos2d-x-master\projects\xamltest2\proj.wp8-xaml\Debug\xamltest2Component\PhoneDirect3DXamlAppComponent.winmd’ could not be found

oh replaced with #include “platform/wp8-xaml/InputEvent.h” and got error removed but only with new errors… :slight_smile:

Error 1 ‘PhoneDirect3DXamlAppComponent.Direct3DInterop’ does not contain a definition for ‘NativeResolution’ and no extension method ‘NativeResolution’ accepting a first argument of type ‘PhoneDirect3DXamlAppComponent.Direct3DInterop’ could be found (are you missing a using directive or an assembly reference?) C:\Users\sidsh_000\Desktop\cocos2d-x-master\projects\xamltest2\proj.wp8-xaml\xamltest2\xamltest2\MainPage.xaml.cs 50 30 xamltest2

wow… iam really stuck now … i changed the d3dinterop .h and .cpp and it has definition property Windows::Foundation::Size NativeResolution;
property Windows::Foundation::Size RenderResolution;
property Windows::Foundation::Size WindowBounds;

and I am still getting the above error… dont understand why :?

you can send the errors to my email: jingchen.chen@cocos2d-x.org or QQ:450928375 while I’m not quite sure the errors. Thanks.

ok… got that to work … had to clean and build again… i have taken your email … appreciat the offer… i am still getting errors… let me try a bit more… other wise will mail you :slight_smile: … thanks…

will keep posting tho… errors and solutions for other readers having similar problem… :slight_smile: