Wednesday, November 13, 2013

List of IAB Libraries

This project includes a unified in app purchase concept:
https://github.com/onepf/OpenIAB

This project extends Google Billing v2 to include Amazon
https://github.com/christopherperry/RoboBillingLibrary


Thursday, October 10, 2013

Guide and SQLite3 Optimization Checklist

This guide has lots of great information in it about optimizing your SQlite3 database, either for mobile or desktop use.

http://web.utk.edu/~jplyon/sqlite/SQLite_optimization_FAQ.html


Helpful Use of atanf2 for rotation of sprites

This code can translate right to Cocos2d-x

http://www.pavley.com/2011/11/28/cocos2d-iphone-sprite-rotation-to-an-arbitrary-point/

Saturday, August 31, 2013

Google Quality Problems in Android 4.3

I know that I am very disappointed to learn that the Android team's quality control process is so lacking that it permits issues like this to reach production:


https://code.google.com/p/android/issues/detail?id=58385


I just think that at this point it appears that Android, the OS and the toolchain, have grown too complex for Google's teams to handle.


Google, and the Android team, are rapidly falling behind on quality in both the development tools and the OS releases, even for flagship devices like the Nexus 7 and Nexus 10.


This issue above is only one of a dozen fatal flaws in the Android OS and recent releases of the ADT have exhibited similar lapses in discipline.


I would speculate that this could represent a chance for someone seeking to take marketshare from Google with developers to capitalize on Google's current weak position.

Wednesday, August 21, 2013

Sunday, August 18, 2013

IAB v3 Stuff ... v2 Stuff ... Google IAP Android

How to implement IAB v3
http://developer.android.com/google/play/billing/billing_integrate.html

but if you are using sharedUserId, you will be stuck with IAB v2
http://developer.android.com/google/play/billing/v2/api.html

Either way your Android application will need a custom list view
http://www.ezzylearning.com/tutorial.aspx?tid=1763429

ListView, you remember this good old fashion Android UI widget?
http://developer.android.com/reference/android/widget/ListView.html

Now, once you get through all that then you start digging into the API
http://developer.android.com/google/play/billing/v2/api.html

You will have errors. They might be this error about developer keys:
http://stackoverflow.com/questions/11068686/this-version-of-the-application-is-not-configured-for-billing-through-google-pla



A typical in-app billing implementation relies on three components:
  • Service (namedBillingService in the sample application), which processes purchase messages from the application and sends billing requests to the Google Play in-app billing service.
  • BroadcastReceiver (namedBillingReceiver in the sample application), which receives all asynchronous billing responses from the Google Play application.
  • A security component (named Security in the sample application), which performs security-related tasks, such as signature verification and nonce generation. For more information about in-app billing security, seeSecurity controls later in this document.
You may also want to incorporate two other components to support in-app billing:
  • A response Handler (named ResponseHandler in the sample application), which provides application-specific processing of purchase notifications, errors, and other status messages.
  • An observer (named PurchaseObserver in the sample application), which is responsible for sending callbacks to your application so you can update your user interface with purchase information and status.
In addition to these components, your application must provide a way to store information about users' purchases and some sort of user interface that lets users select items to purchase. You do not need to provide a checkout user interface. When a user initiates an in-app purchase, the Google Play application presents the checkout user interface to your user. When the user completes the checkout process, your application resumes.

Friday, August 09, 2013

CCParticleSystem in Cocos2d-x with PList File

This code will run a plist particle system in Cocos2d-x

CCParticleSystem* emitter = CCParticleSystemQuad::create("blood.plist");
this->addChild( emitter, 5 );
emitter->setPosition( deadMonster->getSprite()->getPosition());
CCCallFunc* moveCallback = CCCallFunc::create(emitter, 
               callfunc_selector(CCParticleSystem::removeFromParent));
CCDelayTime* delayAction = CCDelayTime::create(0.3f);
emitter->runAction(CCSequence::create(delayAction, moveCallback, NULL));

Wednesday, June 12, 2013

Using with JNI Stack Traces Debug JNI / C++ in Android SYSTEM_TOMBSTONE

First, your application which is written in C++ or being invoked over JNI will crash.

Hello! Honestly we both know it will crash a whole shitload. It's JNI -- what it really does is crash.

So, first we're writing JNI and that ensures we'll see this type of trash spewing out of logcat regularly.

I/DEBUG   ( 9753): *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
I/DEBUG   ( 9753): Build fingerprint: 'verizon/voles/sholes/sholes:2.2.1/FRG83D/75603:user/release-keys'
I/DEBUG   ( 9753): pid: 10400, tid: 10408  >>> com.tresebrothers.games.heroesofsteel <<<
I/DEBUG   ( 9753): signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 00000013
I/DEBUG   ( 9753):  r0 002ba6b4  r1 ffffffff  r2 002ba6a0  r3 002b9908
I/DEBUG   ( 9753):  r4 002a68f0  r5 00000d98  r6 00000400  r7 00000080

[/snip]

I/DEBUG   ( 9753): #01 448b8a50  80e9dad0
I/DEBUG   ( 9753):     448b8a54  8098ae80  /data/data/com.tresebrothers.games.heroesofsteel/lib/libheroesofsteel.so
I/BootReceiver( 9764): Copying /data/tombstones/tombstone_06 to DropBox (SYSTEM_TOMBSTONE)
E/InputDispatcher( 9764): channel '407abe08 com.tresebrothers.games.heroesofsteel/com.tresebrothers.games.heroesofsteel.HeroesOfSteel_android (server)' ~ Consumer closed input channel or an error occurred.  events=0x8
E/InputDispatcher( 9764): channel '407abe08 com.tresebrothers.games.heroesofsteel/com.tresebrothers.games.heroesofsteel.HeroesOfSteel_android (server)' ~ Channel is unrecoverably broken and will be disposed!

I/ActivityManager( 9764): Process com.tresebrothers.games.heroesofsteel (pid 10400) has died.


That entire mess is worthless to us.

Foreign-language-we-do-not-know worthless to us.

We need to translate:
  • First, we download the data from the device (needs root.)
  • Second, we locate the translation tables (comes from the build.)
  • Third, we mash it all together with ndk-stack (comes from the NDK.)


Download the Tombstone Stack Traces

I ran the command
G:\stacks>"C:\Program Files (x86)\Android\android-sdk-windows\platform-tools\adb.exe" pull /data/tombstones/

Had to make sure I had my shell running somewhere with permissions so that adb could write the tombstone files (AKA, not C:\Program Files)

ADB will chew on this for a minute and then print something like this:

pull: building file list...
pull: /data/tombstones/tombstone_01 -> ./tombstone_01
pull: /data/tombstones/tombstone_06 -> ./tombstone_06
pull: /data/tombstones/tombstone_07 -> ./tombstone_07
pull: /data/tombstones/tombstone_08 -> ./tombstone_08
pull: /data/tombstones/tombstone_05 -> ./tombstone_05
pull: /data/tombstones/tombstone_04 -> ./tombstone_04
pull: /data/tombstones/tombstone_02 -> ./tombstone_02
pull: /data/tombstones/tombstone_09 -> ./tombstone_09
pull: /data/tombstones/tombstone_00 -> ./tombstone_00
pull: /data/tombstones/tombstone_03 -> ./tombstone_03
10 files pulled. 0 files skipped.
1564 KB/s (607224 bytes in 0.379s)

This cannot be helped but at least your files were downloaded (if you were lucky.)


Locate the Translation Objects

They are located in {PROJ.ROOT}\obj\local\armeabi\

If you are using Cocos2d-x then it is like this:
G:\cocos2d-2.1rc0-x-2.1.2\YourCoolGame\proj.android\obj\local\armeabi


Run NDK-Stack

I ran the command
G:\android-ndk-r8d\ndk-stack.exe -sym G:\cocos2d-2.1rc0-x-2.1.2\HeroesOfSteel\proj.android\obj\local\armeabi -dump G:\strace\tombstone_06

If you do it all right you get something that looks like this and might tell you something about what is wrong with your program. Probably not. But it does include some line numbers which is better than afd11060 e2166903 1a000017 e5945000 e1a02004.

So this is what it ends up looking like:

********** Crash dump: **********
Build fingerprint: 'verizon/voles/sholes/sholes:2.2.1/FRG83D/75603:user/release-keys'
pid: 10322, tid: 10330  >>> com.tresebrothers.games.heroesofsteel <<<
signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 802bb1f8
Stack frame #00  pc 00013488  /system/lib/libc.so (dlfree)
Stack frame #01  pc 00014726  /system/lib/libc.so (free)
Stack frame #02  pc 00300528  /data/data/com.tresebrothers.games.heroesofsteel/lib/libheroesofsteel.so: Routine sqlite3MemFree in G:/cocos2d-2.1rc0-x-2.1.2/HeroesOfSteel/proj.android/../../StoryTeller
Core/proj.android/jni/../../Classes/sqlite3.c:15578


These were really useful pages




This 'addr2line' stuff is waaaaay too tedious to even consider. NDK-Stack is painful enough as is!

Love you, mean it.

-C

Friday, June 07, 2013

How to push an APK to non-root Android device with adb

Step 1: Transfer the APK File

C:\Program Files (x86)\Android\android-sdk-windows\platform-tools>adb push "G:\SVN_Android\Star Traders.apk" /sdcard/1.apk
1013 KB/s (14509331 bytes in 13.986s)

Step 2: Create a Shell
C:\Program Files (x86)\Android\android-sdk-windows\platform-tools>adb shell
$ cd /sdcard
cd /sdcard
$ ls
ls
LOST.DIR
Android
DCIM
download
catlog_saved_logs
1.apk

Step 3: Execute the installer
$ pm install 1.apk
pm install 1.apk
        pkg: 1.apk
Success
$


Step 4: Check LogCat
D/dalvikvm(  703): GC_FOR_MALLOC freed 26029 objects / 1033352 bytes in 228ms
D/PackageManager(  703): Scanning package com.corytrese.games.startraders
I/PackageManager(  703): /data/app/com.corytrese.games.startraders-1.apk changed; unpacking
D/installd(   60): DexInv: --- BEGIN '/data/app/com.corytrese.games.startraders-1.apk' ---
D/dalvikvm( 1804): DexOpt: load 1152ms, verify 3241ms, opt 139ms
D/installd(   60): DexInv: --- END '/data/app/com.corytrese.games.startraders-1.apk' (success) ---
I/ActivityManager(  703): Force stopping package com.corytrese.games.startraders uid=10046
D/PackageManager(  703):   Activities: com.corytrese.games.startraders.menu.MainMenu com.corytrese.g

Sunday, June 02, 2013

Heroes of Steel RPG ... Progress


cocos2d: deallocing CCDirector 024CCF18
The thread 'Win32 Thread' (0x53f4) has exited with code 0 (0x0).
The thread 'Win32 Thread' (0x44a8) has exited with code 0 (0x0).
No memory leaks detected.
Visual Leak Detector is now exiting.
The program '[19616] HeroesOfSteel.win32.exe: Native' has exited with code 0 (0x0).

Tuesday, May 28, 2013

C++ Questions / Interview / Mastery

I am going to try to answer this list of questions about C++




  • How many ways are there to initialize a primitive data type in C++ and what are they?
  • Why should you declare a destructor as virtual?
  • What does it mean that C++ supports overloading?
  • What are examples of overloading in C++?
  • What is name mangling in C++ and why is it used?
  • What is an abstract base class?
  • What is RTTI?
  • How can you access a variable that is “hidden” by another variable of the same name?
  • What is a namespace and how is it used.
  • What are the differences between a class and a struct in C++, and how does this compare to C?
  • What are templates? How are they used?
  • What is a copy constructor and when is it used, especially in comparison to the equal operator.
  • What is the difference between a “shallow” and a “deep” copy?
  • What is the const operator and how is it used?
  • What are the differences between passing by reference, passing by value, and passing by pointer in C++?
  • When is it and when is it not a good idea to return a value by reference in C++?
  • What is the difference between a variable created on the stack and one created on the heap?
  • How do you free memory allocated dynamically for an array? What are the implications of just using delete?
  • What is multiple inheritance? When should it be used?
  • What is a pure virtual function?
  • What does the keyword mutable do?
  • What does the keyword volatile do?
  • What is the STL?
  • What is a Vector?
  • What is contained in the header?
  • What is the difference between #include and #include ?
  • What’s the difference between “++i” and “i++”?
  • What is short circuit evaluation? How can it be used? Why can is be dangerous?
  • What is the ‘,’ operator?
  • What is the only ternary operator? How is it used?
  • What is the use of a const member function and how can it be used?
  • How is try/catch used in C++?
  • Why should you never throw an exception in a destructor?
  • What is the explicit keyword?
  • What is the proper way to perform a cast in C++?
  • What does inline do?



Monday, May 27, 2013

Debugging Visual Studio Memory Leaks in C++ and Cocos2d-x

Visual Leak Detector is a life-saver, download for free:

https://vld.codeplex.com/documentation

Quick check possible with this code snippet


#if defined(DEBUG) | defined(_DEBUG)
  _CrtSetDbgFlag( _CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF );
#endif

Saturday, April 27, 2013

Google Play Developer Console: Upload Failed (Error uploading APK)

Are you getting this error?

Inline image 1

You need to refresh your browser. The application running at https://play.google.com/apps/publish/v2/ wants to be refreshed regularly or it stops functioning. Sometimes I need to clear cache / restart Chrome to get it to come back to life.

Tuesday, April 09, 2013

Upgrade from cocos2d-2.0-x-2.0.4 to cocos2d-2.1rc0-x-2.1.2


- CCDirector::sharedDirector()->getScheduler()->unscheduleAllSelectorsForTarget(this);
+ CCDirector::sharedDirector()->getScheduler()->unscheduleAllForTarget(this);



-       virtual cocos2d::SEL_MenuHandler onResolveCCBCCMenuItemSelector(CCObject * pTarget, cocos2d::CCString * pSelectorName);
-       virtual cocos2d::extension::SEL_CCControlHandler onResolveCCBCCControlSelector(cocos2d::CCObject * pTarget, cocos2d::CCString * pSelectorName);
-       virtual bool onAssignCCBMemberVariable(cocos2d::CCObject * pTarget, cocos2d::CCString * pMemberVariableName, cocos2d::CCNode * pNode);
+       virtual cocos2d::SEL_MenuHandler onResolveCCBCCMenuItemSelector(CCObject * pTarget, const char * pSelectorName);
+       virtual cocos2d::extension::SEL_CCControlHandler onResolveCCBCCControlSelector(cocos2d::CCObject * pTarget, const char * pSelectorName);
+       virtual bool onAssignCCBMemberVariable(cocos2d::CCObject * pTarget, const char * pMemberVariableName, cocos2d::CCNode * pNode);


-       CCScale9Sprite *backgroundButton2 = CCScale9Sprite::spriteWithFile("button.png");
-       CCScale9Sprite *backgroundHighlightedButton2 = CCScale9Sprite::spriteWithFile("buttonHighlighted.png");
-       CCLabelTTF *menuButton = CCLabelTTF::labelWithString("Menu", "Marker Felt", 30);
+       CCScale9Sprite *backgroundButton2 = CCScale9Sprite::create("button.png");
+       CCScale9Sprite *backgroundHighlightedButton2 = CCScale9Sprite::create("buttonHighlighted.png");
+       CCLabelTTF *menuButton = CCLabelTTF::create("Menu", "Marker Felt", 30);



-       dbPath = CCFileUtils::sharedFileUtils()->getWriteablePath();
+       dbPath = CCFileUtils::sharedFileUtils()->getWritablePath();


-               fullPath = CCFileUtils::sharedFileUtils()->fullPathFromRelativePath("data.mp3");
+               fullPath = CCFileUtils::sharedFileUtils()->fullPathForFilename("data.mp3");






Saturday, April 06, 2013

Tracking SQLite3 Database Version with user_version Pragma

Building an SQLite3 layer into your games without the help of Android's awesome SQLiteOpenHelper? One thing you will need to keep track of is the version of the schema in use in your SQLite database.

Thankfully, the SQLite database and the API for accessing it provides some functions that will help you out.

in particular, these commands are "pragma" which reads and sets values in a properties list of the database and "user_version" which is an in-built database property intended to be used to track schema version.

sqlite> pragma user_version=10;
sqlite> pragma user_version;
user_version
------------------------------
10

sqlite> pragma user_version=12;
sqlite> pragma user_version;
user_version
------------------------------
12

This is the same process that your SQLiteOpenHelper implementation with Android uses, and provides you the ability to write onCreate and onUpdate methods as you would in Java.

http://stackoverflow.com/questions/2659797/how-do-i-use-sqlite3-pragma-user-version-in-objective-c

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

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

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:

My challenge here was that I needed to add these to every static AND shared library I was building.

APP_ABI := armeabi

Android Developer? Windows? Download Ant Now!

You'll thank me if you do.

http://ant.apache.org/bindownload.cgi

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



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

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  

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

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 ...
  • 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=&currentPage=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:



Monday, January 14, 2013

Convert from iPhone to iPad XIB


You can convert iPhone xib into iPad xib using following step.
Right click the file (in xcode) and Open As > Source Code
The 2nd line should look like:
 type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="7.10">
Replace with:

 type="com.apple.InterfaceBuilder3.CocoaTouch.iPad.XIB" version="7.10">
Search for "IBCocoaTouchFramework" and Replace all occurrences with "IBIPadFramework"
Save the file and Open As > Interface Builder - iOS
you can do this for al xib...and you have your iPhone xib now in iPad xib.