7 Important things need to do for a new cocos2d-x project

After a new cocos2d-x project is created and able to build & run, there are still few things to be done before in order to make your further developments more smooth;

1. Setup the Source control

Source control is always important to a developer, we can get an earlier version if the current version is crashed; The earlier we setup the source control, the safer of our source code;
Note that there is always a chance that your project or your computer will be crashed and we need to do a recovery task;

I recommend to use Git as your source control setting because it is popular and really good!

Git Server:

Git Client: 

2. Run on all real device

Running on real device is quite important for iOS and Android development because our final build should be on the device but not the simulator; Besides some of the feature such as accelerometer, multi-touch, are hardly test on the simulator;

HOW-TO deploy in iPhone:
http://goo.gl/2v2Fsc

HOW-TO deploy in Android:
http://developer.android.com/training/basics/firstapp/running-app.html

3. Set the screen orientation

Screen orientation and screen size are two major things to be defined during the design phase;
They are important for both Graphics/UI design and implementation;

Default orientation is Landscape;

HOW-TO
http://www.cocos2d-x.org/wiki/Device_Orientation

Besides using single orientation, we can choose to use multiple orientation like “Candy Crush” do; However, it is a hard work, you need to design and implement for each orientation; In addition, you might need to trap the “screen rotated” signal for both “iOS” and “Android” platform;

4. Set the screen resolution policy

Right after setting screen orientation, we should set define a fixed design screen size and screen resolution policy; After setting these two items, you will be get rid of the troubles about how the layout will be shown in different resolutions in different devices;

HOW-TO 
Here is the code snippet about how to set the policy
https://gist.github.com/tklee1975/d6cca60bf94a6ddc4088

Other Reference:
http://www.cocos2d-x.org/wiki/Multi_resolution_support

5. Configure DEBUG & RELEASE Build

To separate the Debug and Release Build, it is not really hurry once you created the project; But the earlier it is done, the better it is;

In Debug Build, we may have the testing code, frame rate stat information, and flag for debug;
In Release Build, we need hide those testing stuff and set the optimisation flags for compiler;

By default, iOS project is configured with the Debug Build and Android is configured with a simple setting (not Debug)

HOW-TO in iOS:
In Xcode, Create a new scheme; And edit the theme and change “Build configuration” to “Release”

HOW-TO in Android:
(Sorry, I am looking for a good answer too, please leave a comment if you know)
Screen Shot 2015-02-03 at 2.46.42 am

Screen Shot 2015-02-03 at 2.47.12 am

6. Configure the Multi-touch setting

By default, iOS is not enable Multiple Touch and Android is enabled the Multiple Touch;
It is important to define what we want about the touch; Different touch behaviour will affect how we deal the touch input;
Recently, I am making a TicTacToe game and I missed this setting; As a result, the marks were mess up when two touches were down at the same time and the game fail to play;

HOW-TO:

7. Compile the sources automatically in Android Build

By default, Android build script ‘build_native.py’ only build those files defined in Android.mk;
If you just need to add few files, it is easy to modify the Android.mk; But if there are lots of files to be added, for example, you just added a 3rd party libraries, you will be exhausted;

HOW-TO: 

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s