I just installed cocos2d-x and start using with XCode 11. I created a Helloworld sample project with following commands from Terminal.
cocos new Test -p com.mindcob.readisdead -l cpp -d ./
cd Test
mkdir ios-build && cd ios-build
cmake … -GXcode -DCMAKE_SYSTEM_NAME=iOS -DCMAKE_OSX_SYSROOT=iphoneos
It’s working fine. I just copied the image HelloWorld.png, remain it to HelloWorld1.png and add that to project but code isn’t loading that while I’m creating Sprite. Please help me as I’ve wasted hours on that. Thanks
I user following command to create the project and then just add an image names “Button_Grid_On.png”. Tried from Code to create a sprite but App crashed every time with error that file not available.
cocos new HelloWorld -p com.mindcob.test -l cpp -d ./
cd HelloWorld
mkdir ios-build && cd ios-build
cmake … -GXcode -DCMAKE_SYSTEM_NAME=iOS -DCMAKE_OSX_SYSROOT=iphoneos
Another question is why we need to create the director ios-build when we already have a directory named proj.ios_mac/ios. In cocos2d-x v3 it wasn’t required. I’m on XCode 11.2. Please help me here. Thanks
I can’t download your project due to internet issue. I follow your steps and add image to my project and it works. How do you add your image to your project? When you change your resource files, you need update your resources to project by cmake .. in your project build directory.
Why v3 does not require is that there is a xcode template project in templates/cpp-template-default/proj.ios_mac/. Since v4 uses CMake we don’t need a template project anymore, so we should create a build folder and execute CMake command to generate the project.