Game Center and Cocos2D-x

Hi,

I’ve been trying to add Game Center functionalities to my Cocos2D-x project with no luck.
I checked out different tutorials on the web but the problem is that all of them are in ObjectiveC.

I found a test application called GKTapper which shows how to use GameCenter, these are the files:
http://www.kiwicode.org/share/GameCenterManager.h
http://www.kiwicode.org/share/GameCenterManager.m
http://www.kiwicode.org/share/AppSpecificValues.h

I know it’s possible to mix C++ with ObjectiveC like in CocosDenshion. I guess that doing the same for the
GameCenterManager files would help integrating Game Center to my Cocos2D-x project. The problem is that I’m not very familiar
with ObjectiveC ( that’s why I chose to work with Cocos2Dx ).

These are my questions:

  • Does any of you know any good tutorial/example which shows how to integrate Game Center with Cocos2D-x ( I googled with no luck ).
  • Do you think mixing GameCenterManager with objectiveC might be a solution to solve this problem? Is any of you able to do this, I guess this would help the whole Cocos2D-x community.

Looking forward to your reply.

Many thanks!


AppSpecificValues.h.zip (1.8 KB)

Hi John,

I guess you are on the correct path. I take similar approaches to use the reachability class, or the in-app purchases features. First make sure the tutorials section doesn’t include a tutorial about this. What I can tell you is you can find some tutorials about mixing c++ and objective c on the internet, and some of them in my blog (www.plungeinteractive.com/blog).

Cheers!

Thanks for your help!

I’m sorting out the problem by mixing C*+ and ObjectiveC. I’ve started getting the first results like Game Center authentication, score submission etc.
Part of the problems are also coming from iOS programming itself .
I’m very unfamiliar with ObjectiveC, that’s why I chose Cocos2D-x to develop my current project.
I think a C*+ library to help users to do all this GameCenter stuff is missing. After my current project is done I’ll consider working on such library for all Cocos2D-x users.

yep, your problems are common :) at the end you will have to learn some objective-c unfortunately ;)