Questions tagged [cocos2d-x]

C++ cross-platform version of Cocos2D, an open-source mobile 2D game framework.

Cocos2d-x is a C++ open-source mobile 2D game framework, released under MIT License. Initially it evolved from cocos2d-iphone () but is now a largely independent framework.

On top of the framework provided by Cocos2d-X (), mobile games can be written in C++ or Lua, using a similar API to that of cocos2d-iphone. Cocos2d-x projects can be deployed to iOS (), Android (), Samsung Bada, BlackBerry Table OS and other devices. Editing and debugging can be done on a variety of desktop operating systems with popular IDEs like Xcode, Visual Studio and others.

The current version is v4.0

Resources:

Books:

3886 questions
16
votes
1 answer

Out-of-line definition error on a class but it is declared in the header file

Now this is a weird problem. I was coding two days ago and stopped and then continued just now. On my header file (Fruit.h) I added a method called animateGrow() like so: Fruit.h: class Fruit { private: // Member variables here public: //…
alxcyl
  • 2,722
  • 7
  • 31
  • 47
15
votes
3 answers

Convert Spritekit Game to Android?

Are there any new options for converting a spritekit game to android? It seems the only options are to recode everything in Java or to use Cocos2D, LibGDX, etc.
user6025921
  • 165
  • 1
  • 5
15
votes
5 answers

Use new firebase sdk in android eclipse project

new firebase with awesome features was just announced, but according to documentation (https://firebase.google.com/docs/android/setup#prerequisites) android studio (as well as gradle) is required now. For now in my cocos2d-x apps I have to use…
Makalele
  • 7,431
  • 5
  • 54
  • 81
15
votes
3 answers

How do you load a scene while animating a sprite in cocos2d-x?

I have a "stage selection" scene and a "game" scene. However when the user presses the button to start the game scene there is a delay between the pressing and the scene showing (about 2 seconds or more on older devices). So what i thought is i…
Pochi
  • 13,391
  • 3
  • 64
  • 104
15
votes
1 answer

TDD for Cocos2d-X in android

How do I write the TDD for "is sprite added or not" in the scene for cocos2d-x in eclipse. Here is my code CCSprite *sprite =null; //adding sprite code sprite = new…
RohitK
  • 1,444
  • 1
  • 14
  • 37
15
votes
4 answers

How to set background color of layer in cocos2d-x?

I've been writing a game using cocos2d-x and ran into an issue with changing the background color. I found an example in cocos2d, but apparently this only applies to cocos2d which is written in Obj-c. Basically the idea is to use a CCLayerColor…
Edward
  • 7,346
  • 8
  • 62
  • 123
15
votes
3 answers

Sending a android.content.Context parameter to a function with JNI

I am trying to create a method that checks for internet connection that needs a Context parameter. The JNIHelper allows me to call static functions with parameters, but I don't know how to "retrieve" Cocos2d-x Activity class to use it as a…
MLProgrammer-CiM
  • 17,231
  • 5
  • 42
  • 75
14
votes
1 answer

Xcode 11, Cocos2dx compilation problem: Argument value 10880 is outside the valid range [0, 255] btVector3.h

Please see attach image. In Xcode 11, Cocos2d-x giving error : Argument value 10880 is outside the valid range [0, 255] btVector3.h Error coming for code line y = bt_splat_ps(y, 0x80); // in file btVector3.h How to solve this ?
Guru
  • 21,652
  • 10
  • 63
  • 102
14
votes
4 answers

Android JNI - Call function on Android UI thread from C++

Our game engine Cocos2d-x runs natively on android on its own non-Java-UI-thread. We need to call certain Java functions from C++ via JNI on the Android UI thread. For calling JNI-Functions, we're using the JNIHelper.h/cpp from here…
keyboard
  • 2,137
  • 1
  • 20
  • 32
14
votes
5 answers

How can I include cocos2d-x templates in Xcode?

I'm trying to follow this guide which is often quoted as being an excellent tutorial for Cocos2d-x. The problem is that my downloads for Cocos2d-x (2.2 and 3.0 alpha0) do not include the file the tutorial indicates, install-templates-xcode.sh. Any…
D'Arcy Rail-Ip
  • 11,505
  • 11
  • 42
  • 67
14
votes
2 answers

cocos2d-x-2.1.4 : error: format not a string literal and no format arguments [-Werror=format-security]

I am working on a game on cocos2d-x-2.1.4, however, when I try to build it on Android, it failed with the error: format not a string literal and no format arguments [-Werror=format-security] on the file CCCommon.cpp However, when I check the…
Jenny Kim
  • 1,505
  • 2
  • 16
  • 25
13
votes
7 answers

Scanning files to index never ends in Android Studio 4.1

I'm using cocos2d-x v4, macOS Catalina 10.15.6, Android Studio 4.1. I made a project with cocos2d-x v4. I'm using Android Studio to build an android app. Until a few days ago it worked. But after updating Android Studio to 4.1, everything went…
noprops
  • 311
  • 3
  • 12
13
votes
1 answer

fontconfig/fontconfig.h not found in Codeblocks

I am trying to build Cocos2d-x project in Codeblocks IDE in Ubuntu 14. I got fontconfig/fontconfig.h not found error during compiling. I'm stuck here. How can I solve this?
charlotte
  • 1,031
  • 3
  • 12
  • 19
13
votes
2 answers

Cocos2d-x - Error drawing cubic bezier curves

I'm trying to draw a cubic bezier path with a certain thickness, but the curve appears like a sequence of disconnected segments (3 in my case). This is a screenshot (the blue circles are the control points of the curve). I noticed that the same…
Joe Aspara
  • 1,137
  • 1
  • 13
  • 26
13
votes
1 answer

How to check crash log using android ndk in cocos2d-x

I use cocos2d-x to develop a game, after it runs perfectly in iOs, I turn around to android platform. But it run somewhere in android, and I only receive some error log like this: 08-26 10:49:23.823: A/libc(2884): Fatal signal 11 (SIGSEGV) at…
pktangyue
  • 8,326
  • 9
  • 48
  • 71