How critical is this for Cocos2dx games? Very critical!
http://digitalsynapsesblog.blogspot.com/2011/09/cocos2d-x-launching-url-on-android.html
Development blog discussing configuring, building, and managing software. Including coverage of Debian Linux, .NET development projects, Perl and development tools
Friday, March 22, 2013
Wednesday, March 20, 2013
Using Cocos Builder with Cocos2D-x
Reading the source code for some tests really helps
https://projects.developer.nokia.com/cocos2dxqt/browser/tests/tests/ExtensionsTest/ControlExtensionTest/CCControlButtonTest/CCControlButtonTest.cpp
But by far the most important thing is this documentation:
https://github.com/cocos2d/CocosBuilder/blob/develop/Documentation/4c.%20Connecting%20with%20cocos2d-x.md
https://projects.developer.nokia.com/cocos2dxqt/browser/tests/tests/ExtensionsTest/ControlExtensionTest/CCControlButtonTest/CCControlButtonTest.cpp
But by far the most important thing is this documentation:
https://github.com/cocos2d/CocosBuilder/blob/develop/Documentation/4c.%20Connecting%20with%20cocos2d-x.md
Tuesday, March 19, 2013
CCB Error with Cocos2d-x 2.0.4 and Cocos Builder (CCB)
Assertion failed: (ccNodeLoadersIterator != this->mCCNodeLoaders.end()), function getCCNodeLoader, file /Users/corytrese/Desktop/Development/SDK/cocos2d-2.0-x-2.0.4/HeroesOfSteel/proj.ios/../../extensions/CCBReader/CCNodeLoaderLibrary.cpp, line 70.
Translation: "You have put the wrong object type into the CCB file, under 'CustomClass' on your CCLayer.
Probably you put in your Scene not your child of cocos2d::CCLayer and
public cocos2d::extension::CCBSelectorResolver
Easy to fix once you figure out what that assertion is testing.
Using JNI? You'll Have Make Errors
When you get those mysterious 'make' errors, you'll need this reference:
http://www.gnu.org/software/make/manual/html_node/Error-Messages.html
http://www.gnu.org/software/make/manual/html_node/Error-Messages.html
Friday, March 15, 2013
Reading and Writing Files in C++ and Cocos2Dx
How to write a simple text file with Cocos2dx
http://www.cocos2d-x.org/boards/6/topics/10822
Someone tries to load XML file in Cocos2dx (and gets very close!)
http://www.cocos2d-x.org/boards/6/topics/882
Biggest Struggle for Cocos2dx file loading ... is Android. Look out for this issue
http://stackoverflow.com/questions/8220527/android-reading-a-text-file-from-assets-seems-to-include-a-lot-of-junk-before
There are many ways to copy one file to another file in C++
http://stackoverflow.com/questions/10195343/copy-a-file-in-an-sane-safe-and-efficient-way
Debugging bonus link:
http://www.cocos2d-x.org/boards/6/topics/12601
If you get all of the above working, soon you'll want to add IAP
http://www.cocos2d-x.org/boards/6/topics/20664
Here is a good link that shows syntax differences between Cocos2d and Cocos2dx
http://www.rengelbert.com/tutorial.php?id=190
http://www.cocos2d-x.org/boards/6/topics/10822
Someone tries to load XML file in Cocos2dx (and gets very close!)
http://www.cocos2d-x.org/boards/6/topics/882
Biggest Struggle for Cocos2dx file loading ... is Android. Look out for this issue
http://stackoverflow.com/questions/8220527/android-reading-a-text-file-from-assets-seems-to-include-a-lot-of-junk-before
There are many ways to copy one file to another file in C++
http://stackoverflow.com/questions/10195343/copy-a-file-in-an-sane-safe-and-efficient-way
Debugging bonus link:
http://www.cocos2d-x.org/boards/6/topics/12601
If you get all of the above working, soon you'll want to add IAP
http://www.cocos2d-x.org/boards/6/topics/20664
Here is a good link that shows syntax differences between Cocos2d and Cocos2dx
http://www.rengelbert.com/tutorial.php?id=190
Android SDK / NDK Debugging (device does not support the application's targetted CPU ABI)
First, just go into this assuming it is really hard.
You have two options that I can see.
First, Eclipse + CDT + NDK + ADT + SDK.
http://tools.android.com/recent/usingthendkplugin
Second, Visual Studio + WinDBG + NDK + SDK
http://www.wingdb.com/wgMobileEdition.htm
(http://ian-ni-lewis.blogspot.com/2011/01/its-like-coming-home-again.html)
I'm trying this with Cocos2d-x which makes it easier and harder at the same time.
The bad -- poor documentation, lots of unanswered questions
http://www.cocos2d-x.org/boards/6/topics/11046
The good -- ndkgbd.sh
--------------------------------------------
http://stackoverflow.com/questions/15067215/ndk-gdb-error-device-does-not-support-the-applications-targetted-cpu-abis
jni/Android.mk:26: *** Android NDK: Aborting. . Stop.
ERROR: The device does not support the application's targetted CPU ABIs!
Device supports: armeabi-v7a armeabi
Package supports: Android NDK:
You have two options that I can see.
First, Eclipse + CDT + NDK + ADT + SDK.
http://tools.android.com/recent/usingthendkplugin
Second, Visual Studio + WinDBG + NDK + SDK
http://www.wingdb.com/wgMobileEdition.htm
(http://ian-ni-lewis.blogspot.com/2011/01/its-like-coming-home-again.html)
I'm trying this with Cocos2d-x which makes it easier and harder at the same time.
The bad -- poor documentation, lots of unanswered questions
http://www.cocos2d-x.org/boards/6/topics/11046
The good -- ndkgbd.sh
--------------------------------------------
http://stackoverflow.com/questions/15067215/ndk-gdb-error-device-does-not-support-the-applications-targetted-cpu-abis
jni/Android.mk:26: *** Android NDK: Aborting. . Stop.
ERROR: The device does not support the application's targetted CPU ABIs!
Device supports: armeabi-v7a armeabi
Package supports: Android NDK:
My challenge here was that I needed to add these to every static AND shared library I was building.
APP_ABI := armeabi
APP_OPTIM := debug
Here is a guide for Eclipse:
http://mhandroid.wordpress.com/2011/01/23/using-eclipse-for-android-cc-debugging/
Here is a guide for Eclipse:
http://mhandroid.wordpress.com/2011/01/23/using-eclipse-for-android-cc-debugging/
Android SDK Cannot Contain Spaces -- How to Fix?
Set you SDK_ROOT to something like this:
C:\PROGRA~2\Android\android-sdk-windows
http://stackoverflow.com/questions/6629273/android-emulator-invalid-command-line-parameter
Very useful for WinDBG
http://www.wingdb.com/wgMobileEdition.htm
C:\PROGRA~2\Android\android-sdk-windows
http://stackoverflow.com/questions/6629273/android-emulator-invalid-command-line-parameter
Very useful for WinDBG
http://www.wingdb.com/wgMobileEdition.htm
Thursday, March 14, 2013
C++ Inheritance and Virtual Functions
This link was really useful for understanding 'virtual' and how it works in the C++ syntax.
http://www.flipcode.com/archives/Using_Inheritance_And_Virtual_Functions.shtml
http://www.flipcode.com/archives/Using_Inheritance_And_Virtual_Functions.shtml
Cocos2d-x Events and Watchdog
The app delegate method
applicationDidEnterBackground:
is called after your application transitions to the background, but before your application is suspended. Unfortunately, you may not perform any GPU instructions while in the background, or the watchdog will terminate you (as you're seeing here).libGPUSupportMercury.dylib`gpus_ReturnNotPermittedKillClient:
0x3797e094: trap
0x3797e096: nop
Saturday, March 09, 2013
Friday, March 08, 2013
Cocos2dx Replace Scene Crashes
If you try to call Replace Scene while constructing a Scene, the game will crash or not show the Scene.
http://stackoverflow.com/questions/12333459/cocos2d-x-replacescene-causes-app-crash
http://stackoverflow.com/questions/12333459/cocos2d-x-replacescene-causes-app-crash
Thursday, March 07, 2013
Cocos2dx Extensions
This page was useful:
http://www.cocos2d-x.org/boards/6/topics/19388
For Visual Studio, add the following argument to the build command line:
/I"\cocos2d-2.0-x-2.0.4\extensions"
For Android.mk file, add the following line to the end
$(call import-module,extensions) \
For XCode, add the "extensions" folder to the project
http://www.cocos2d-x.org/boards/6/topics/19388
For Visual Studio, add the following argument to the build command line:
/I"\cocos2d-2.0-x-2.0.4\extensions"
For Android.mk file, add the following line to the end
$(call import-module,extensions) \
For XCode, add the "extensions" folder to the project
Wednesday, March 06, 2013
Project Setup Links for Cocos2dx
Building new projects several useful methods
http://paralaxer.com/cocos2d-x-project-setup/
Creating a win32 cocos2dx environment
http://www.jesusbosch.com/2012/06/how-to-set-up-android-and-win32-cocos2d.html
the official visual studio user's guide
http://www.cocos2d-x.org/projects/cocos2d-x/wiki/Cocos2d-x_Application_Wizard_for_Visual_Studio_User_Guide
hybrid box2d setup
http://www.bold-it.com/ios/cocos2d-x-box2d-iosandroid-hybrid-tutorial/
http://paralaxer.com/cocos2d-x-project-setup/
Creating a win32 cocos2dx environment
http://www.jesusbosch.com/2012/06/how-to-set-up-android-and-win32-cocos2d.html
the official visual studio user's guide
http://www.cocos2d-x.org/projects/cocos2d-x/wiki/Cocos2d-x_Application_Wizard_for_Visual_Studio_User_Guide
hybrid box2d setup
http://www.bold-it.com/ios/cocos2d-x-box2d-iosandroid-hybrid-tutorial/
SQLite on Cocos2dx
The reason we have settled on Cocos2dx over LibGDX is SQLite.
http://stackoverflow.com/questions/11307404/use-database-such-as-sqlite-with-cocos2d-x/11320942#11320942
http://stackoverflow.com/questions/11307404/use-database-such-as-sqlite-with-cocos2d-x/11320942#11320942
Tuesday, March 05, 2013
Mobile Game Cross Platform Development Tools
So I want to make a cross-platform game for mobile devices...lots of choices ...
Bonus link:
Setting up Cocos2dx on Mac OS X:
http://gamedev.stackexchange.com/questions/28743/how-to-setup-cocos2d-x-android-under-mac-os-x
- Xamarin (Monotouch)
- LibGDX + Monotouch
- Cocos2d-x
- Unity 3d
- Shiva 3d
- Corona
- JUCE
- Marmalade (Airplay SDK)
- HTML5 + JavaScript
- JqueryMobile
- Cocos2d-HTML5
- Sio2
- Adobe AIR
Bonus link:
Setting up Cocos2dx on Mac OS X:
http://gamedev.stackexchange.com/questions/28743/how-to-setup-cocos2d-x-android-under-mac-os-x
Bunch of Weird Lines on your TMX File in Cocos2dx?
Try setting CC_FIX_ARTIFACTS_BY_STRECHING_TEXEL (in ccConfig.h) to a value of 1
Having trouble with loading files from 'assets' folder in Android, but it works in win32? Try the suggestions in this StackOverflow but also, check the case of the filenames.
http://stackoverflow.com/questions/12417748/cocos2dx-android-get-data-from-fileassets-failed
Random Bada Tutorial with some good code:
http://developer.bada.com/documentation/docView.do?docID=D000002309&&searchCategoryID=&searchTag=&searchDisplayDate=¤tPage=1&menu=MC01320300&pageCount=10&orderField=DISP_DD_TXT_DESC&searchPubYNFlag=Y
Errors with SimpleAudioEngine? Make sure you include the headers :)
http://stackoverflow.com/questions/12875426/simpleaudioengine-has-not-been-declared-error-when-trying-to-enable-music-paus
Using 2.0? They have moved sharedDispatcher
http://stackoverflow.com/questions/11264191/cocos2d-x-cctouchdispatcher-no-shareddispatcher
Use this:
CCDirector::sharedDirector()->getTouchDispatcher();
Not that:
CCTouchDispatcher::sharedDispatcher()->getTouchDispatcher();
Fixing Compile Issues with Visual Studio Project (.csproj) calling CCEGLView::create?
1. Open Property of Project.
2. Change the item value of "Character Set" to "Use Multi-Byte Character Set".
3. Rebuild your project.
Having trouble with loading files from 'assets' folder in Android, but it works in win32? Try the suggestions in this StackOverflow but also, check the case of the filenames.
http://stackoverflow.com/questions/12417748/cocos2dx-android-get-data-from-fileassets-failed
Random Bada Tutorial with some good code:
http://developer.bada.com/documentation/docView.do?docID=D000002309&&searchCategoryID=&searchTag=&searchDisplayDate=¤tPage=1&menu=MC01320300&pageCount=10&orderField=DISP_DD_TXT_DESC&searchPubYNFlag=Y
Errors with SimpleAudioEngine? Make sure you include the headers :)
http://stackoverflow.com/questions/12875426/simpleaudioengine-has-not-been-declared-error-when-trying-to-enable-music-paus
Using 2.0? They have moved sharedDispatcher
http://stackoverflow.com/questions/11264191/cocos2d-x-cctouchdispatcher-no-shareddispatcher
Use this:
CCDirector::sharedDirector()->getTouchDispatcher();
Not that:
CCTouchDispatcher::sharedDispatcher()->getTouchDispatcher();
Fixing Compile Issues with Visual Studio Project (.csproj) calling CCEGLView::create?
1. Open Property of Project.
2. Change the item value of "Character Set" to "Use Multi-Byte Character Set".
3. Rebuild your project.
'setIsTouchEnabled' : is not a member of 'HelloWorld'
If you are upgrading from Coocs2dx 1.x to Cocos2dx 2.x you will have a lot of conversion to do.
If you get the error:
'setIsTouchEnabled' : is not a member of 'HelloWorld'
you really want to switch the code to this:
this->setTouchEnabled(true);
You might struggle with how to convert a CCObject to an int. Use this type of cast:
int x = ((CCString *)spawnPoint->objectForKey("x"))->intValue();
You might also struggle with callfunc, which is very simple to use in Objective-C but not so easy in Cocos2dx.
http://stackoverflow.com/questions/11917928/callfunc-in-cocos2d-x
This tutorial was very useful building a demo game in Cocos2dx
http://www.raywenderlich.com/1163/how-to-make-a-tile-based-game-with-cocos2d
I was already familiar with it from using Cocos2d.
This commit is really large, but shows a lot of useful conversion moves from early Coocos2dx to modern. This guy or girl knew what he/she was doing and made quick work of a lot of before/after conversion code that made doing similar work on my side very easy. Just search for the code I had and found what they changed it to.
https://github.com/cocos2d/cocos2d-x/pull/779/files
Often we need to concatenate strings using the + operator. A shortcut way to do this in C++ is as follows:
CCSprite *sprite = CCSprite::spriteWithFile((name+".png").c_str());
This was kinda useful tutorial to introduce Cocos2d vs. Cocos2dx from a memory and reference counting standpoint:
http://www.rengelbert.com/tutorial.php?id=188
Cocos2dx Setup: Windows 7 Visual Studio and Eclipse
I have been working on building a cocos2dx application that runs on Windows 7 x64 in Visual Studio, Eclipse, iPhone and MacOS X.
I started with this setup guide:
I had to do a lot of installing ....
- Cocos2d-2.0x (same download for Mac OS X and Win32)
- NDK r8d on Mac OS X and Windows (different downloads for Mac OS X and Win32)
- Newest ADT and Android SDK on Mac OS X and Windows (different downloads)
- Native Development Tools -- Eclipse Plugin
- Android Development Tools -- Eclipse Plugin
- Cygwin on Windows (with : autoconf, automake, binutils, gcc-core, gcc-g++, gcc4-core, gcc4-g++, gdb, pcre, pcre-devel, gawk, make)
- Visual Studio 2010 C++ Language Support
- Eclipse CDT (C++ Development Tools)
- Several Eclipse, Java, Windows and Mac OS X Updates along the way
In the end, I believe that the correct way to configure the application is to have a folder for the project and sub-folders as follows:
- \cocos2d-2.0-x-2.0.4\TileMapGame\Classes
- \cocos2d-2.0-x-2.0.4\TileMapGame\Resources
- \cocos2d-2.0-x-2.0.4\TileMapGame\proj.android
- \cocos2d-2.0-x-2.0.4\TileMapGame\proj.win32
You can get this far using two included .sh scripts
- \cocos2d-2.0-x-2.0.4\create-android-project.bat
- \cocos2d-2.0-x-2.0.4\create-android-project.sh
You will quickly notice that Cocos2d-2.0-x does not come with an easy facility to create an XCode project folder the way it does for Visual Studio and Eclipse.
To create the following folders I used Notepad2 and editing the .xcodeproj files
- \cocos2d-2.0-x-2.0.4\TileMapGame\proj.ios
- \cocos2d-2.0-x-2.0.4\TileMapGame\proj.mac
I started by copying over these folders
- \cocos2d-2.0-x-2.0.4\samples\HelloCpp\proj.ios
- \cocos2d-2.0-x-2.0.4\samples\HelloCpp\proj.mac
Then I made some important changes
- Changed relative paths to 'cocos2dx.xcodeproj'
- Renamed Project
- Reconnected plist file
- Fixed "Header Search Paths" to include correct relative paths
- Converted "Resource" sub-folders to 'groups' by deleting and re-adding
- Added CocosDenshion group and added 'ios' and 'include' folders
- Added missing frameworks
- AudioToolkit
- OpenAL
- AVFoundation
- Set 'version' and deployment targets for iOS and Mac OS X
So at the end I have this structure
- \cocos2d-2.0-x-2.0.4\TileMapGame\Classes
- \cocos2d-2.0-x-2.0.4\TileMapGame\Resources
- \cocos2d-2.0-x-2.0.4\TileMapGame\proj.android
- \cocos2d-2.0-x-2.0.4\TileMapGame\proj.win32
- \cocos2d-2.0-x-2.0.4\TileMapGame\proj.ios
- \cocos2d-2.0-x-2.0.4\TileMapGame\proj.mac
The only two I have not created are 'proj.linux' and 'proj.blackberry' because at this time I do not have any need for them.
I used the following pages for debugging and troubleshooting:
I used the following pages for debugging and troubleshooting:
- Found out you cannot move Visual Studio 2010 Sln file
- Found out you need to add Frameworks for CocosDenshion
- Everyone needs the manual, even if it is way out of date
- How do you add a pesky sub-project (tip: only have it open in one place)
- XCode will not find cocos2d.h if you move the .xcodeproj but don't update header search path
- Never set $SRCROOT yourself
- Some useful hints, but not know I did it
- Dealing with file not found when attempting to debug in XCode (happens a lot)
- http://stackoverflow.com/questions/9987192/xcode-will-run-app-on-simulator-but-not-on-device
- http://dhilipsiva.blogspot.de/2012/07/xcode-could-not-launch-app-no-such-file.html
- Much of the approach above came from reading this
- Under Helios ... to remove plugins ... Help -> Install New Software ... clicked the small blue hyperlink for What is "already installed"; and under the Installed Software tab, this gave me the option to uninstall things.
- Had to install the NDK on both Mac OS X and Windows
- How to build and run
Subscribe to:
Posts (Atom)