Facebook and Twitter integration in cocos2d-x (c++)

Hello,
I want to implement facebook and twitter in my game built in cocos2d-x (c++). Can anyone let me know what is exact procedure to do so? I read few blogs on internet and found them bit confusing. I have followed steps mentioned here [https://developers.facebook.com/docs/ios/getting-started/]. I want to know how can I integrate code in objective C with my cocos2d-x (c++ code). Any suggestions?

  1. Create an Obj-C class that will handle all the Facebook API. Read this: https://developers.facebook.com/docs/ios/ios-sdk-games/ and implement all the things described into this class.
  2. Make the Obj-C class a singleton, or make all methods public static.
  3. Create a C*+ class and save it in a file with a .mm extension. This class will call the Obj-C methods from the Obj-C class created. You can call this C*+ class methods from anywhere within your game.
  4. Optionally, create a wrapper C++ class that will handle both Android and iOS calls. You can trap them using #if (CC_TARGET_PLATFORM==CC_PLATFORM_ANDROID) and #if (CC_TARGET_PLATFORM==CC_PLATFORM_IOS)

Another choice would be to use EziSocial, but I personally didn’t use it. Why bother someone else when you can do it yourself.

If you have limited use then you can download EziSocial plugin and use the free version. For additional functionality you might need to pay.
http://www.ezibyte.com

Dev W wrote:

Hello,
I want to implement facebook and twitter in my game built in cocos2d-x (c++). Can anyone let me know what is exact procedure to do so? I read few blogs on internet and found them bit confusing. I have followed steps mentioned here [https://developers.facebook.com/docs/ios/getting-started/]. I want to know how can I integrate code in objective C with my cocos2d-x (c++ code). Any suggestions?

We had found that EziSocial is not compatible with Soomla Store (in Android, in iOS works well). Reported as an issue in github.
It’s a pitty because its really easy to use.

On iOS just use a wrapper to the iOS 6 Share Sheet. Very easy. No plugins

1 Like

just foucus my tutorial I’ll through you out how to integration facebook in cocos2d-x
Dev W wrote:

Hello,
I want to implement facebook and twitter in my game built in cocos2d-x (c++). Can anyone let me know what is exact procedure to do so? I read few blogs on internet and found them bit confusing. I have followed steps mentioned here [https://developers.facebook.com/docs/ios/getting-started/]. I want to know how can I integrate code in objective C with my cocos2d-x (c++ code). Any suggestions?

@yuye.liu
glad to hear. Waiting for your tutorial.

Hello, we are working on how to integrate Facebook in cocos2d-x.

So, It’ll finish these days. I hope it can help you. thnak you very much.

devendra001 wrote:

Hello,
I want to implement facebook and twitter in my game built in cocos2d-x (c++). Can anyone let me know what is exact procedure to do so? I read few blogs on internet and found them bit confusing. I have followed steps mentioned here [https://developers.facebook.com/docs/ios/getting-started/]. I want to know how can I integrate code in objective C with my cocos2d-x (c++ code). Any suggestions?

hi Yuye,
Can you please give me any lead to integrate twitter?

Hi,
I’ve just made public my repo here https://github.com/hiepnd/Screw. Screw is very flexible with the aim to bring native Facebook SDK functionalities to cocos2d-x. It only supports cocos2d-x v3.
Please try it out and give me some feedbacks :slight_smile:


Feeling excited !!!

@hiepnd we just donwloaded your framework and we are very excited about it. It looks totally awesome :smiley:
Congratulations for an outstanding work!

@ruben@mandukagames.com wrote:

@hiepnd we just donwloaded your framework and we are very excited about it. It looks totally awesome :smiley:
Congratulations for an outstanding work!

Thank you :slight_smile: