Sign In Register

How can we help you today?

Start a new topic

Cocos2d-x SDK work on the other thread....

Hi, I'm using cocos2d-x SDK, but feel laggy if I call update on the main-thread, especially when login. Any example to show how to use SDK on the other thread (better std:thread) ? Or how to modify SDK to let call back always work on the main thread? Thanks Jo

Hi Jo,

I'll pass this on to the dev team and get back to you.



Hello Jo,

I am a bit confused about your questions. Our SDK should work in an asynchronous way without affecting the main thread, at least those operations concern networking stuff. If you are interested about implementing other threads in your code, you may use pthread class of cocos2d-x ( ). I do not think that is a good idea using the standard thread class.


Hello Jo,

Probably we found a malfunction that might affect the slow frame rate discovered by you. Could you comment out this line below, please, and see whether there are improvements?

Also, does it affect your release-builds as well?



Hi, Giuseppe

I tried to comment it out, but it caused compile error. 

(There are 2 "break;" inside the original for block)

Do you mean the for block should be only executed once?


I tried with this link

The documentation is very unclear.Its not working for me.Do you have anything like in your main page for unity.It was so clear there how to integrate sdk in unity.

Please help.

running the sample:-

execute This will install a copy of cocos2d-x.

Open one of the project file located at GameSparksSample/proj.* in you IDE (note that the Android Studio project does not support building from inside the IDE unless you specify cocos as external build tool as described here:

Open Sample/Classes/AppDelegate.h and change the credentials near line 84compile, run

Alternatively you case edit Sample/Classes/AppDelegate.h in any editor and execute

Integrating the SDK into your project

Copy the GameSparksSDK directory into your project

Add the source files to your project: 2.1 Either add all the .cpp, .c and .mm files located at GameSparksSDK/src/** to your project 2.2 Or add GameSparksSDK/src/GameSparksAll.cpp to your project. 2.3 On iOS and macOS you'll also need to add GameSparksSDK/src/GameSparks/ and GameSparksSDK/src/UNIX2003_Fix.cAdd GameSparksSDK/include to your include search paths

Login to post a comment