tag:blogger.com,1999:blog-64374065641161943322024-02-20T00:27:18.339-08:00PinoyDevZeratulhttp://www.blogger.com/profile/15502878100405106115noreply@blogger.comBlogger2125tag:blogger.com,1999:blog-6437406564116194332.post-36293124667518769052013-03-25T20:09:00.001-07:002013-03-25T21:10:09.326-07:00Setting up Cocos2D for Android Development in Windows 7/8<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiONN7VMUoLgIF5hZNI30O2nplwcNntk2FOGUH3kf8_po32JAJfMQKoCTHD0ZLdUMHHvQZ7YOr_Tfu39r8aHNd6Mif45mp2uKzKLLRH5A9MseOJl1mcuKdHh2gvs6uRd2GxaNU8syOUtqY/s1600/cocos2d.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiONN7VMUoLgIF5hZNI30O2nplwcNntk2FOGUH3kf8_po32JAJfMQKoCTHD0ZLdUMHHvQZ7YOr_Tfu39r8aHNd6Mif45mp2uKzKLLRH5A9MseOJl1mcuKdHh2gvs6uRd2GxaNU8syOUtqY/s1600/cocos2d.png" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<h2>
<span style="font-family: Trebuchet MS, sans-serif; font-size: large;">Introduction</span></h2>
<div class="separator" style="clear: both; text-align: left;">
<span style="text-align: justify;"><span style="font-family: Verdana, sans-serif;">Welcome to my tutorial. This is the first time I'm using Cocos2D for a project so bear with me. First things first, we gotta download the needed files to setup the environment.</span></span></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="text-align: justify;"><span style="font-family: Verdana, sans-serif;"><br /></span></span></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="text-align: justify;"><span style="font-family: Verdana, sans-serif;">We will need the following:</span></span></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="text-align: justify;"><span style="font-family: Verdana, sans-serif;"><br /></span></span></div>
<div class="separator" style="clear: both; text-align: left;">
</div>
<ul>
<li><span style="text-align: justify;"><span style="font-family: Verdana, sans-serif;">Your Windows 7 or 8 installed. Either 32-bit (x86) or 64-bit version (x64). Take note, I am running Windows 8 Pro 32-bit now.</span></span></li>
<li><span style="font-family: Verdana, sans-serif;"><span style="text-align: justify;">The latest stable version of Cocos2d-x from </span><a href="http://www.cocos2d-x.org/projects/cocos2d-x/wiki/Download" style="text-align: justify;">http://www.cocos2d-x.org/projects/cocos2d-x/wiki/Download</a></span></li>
<li><span style="font-family: Verdana, sans-serif;">The latest version of the Android SDK from <a href="http://developer.android.com/sdk/index.html#ExistingIDE">http://developer.android.com/sdk/index.html#ExistingIDE</a></span></li>
<li><span style="font-family: Verdana, sans-serif;">The latest version of the Android NDK for your version of Windows from <a href="http://developer.android.com/tools/sdk/ndk/index.html">http://developer.android.com/tools/sdk/ndk/index.html</a></span></li>
<li><span style="font-family: Verdana, sans-serif;">As of this writing, I am using the latest version of the Java JDK (7u17) from <a href="http://www.oracle.com/technetwork/java/javase/downloads/jdk7-downloads-1880260.html">http://www.oracle.com/technetwork/java/javase/downloads/jdk7-downloads-1880260.html</a></span></li>
<li><span style="font-family: Verdana, sans-serif;">Notepad++ for editing unix-based text from <a href="http://notepad-plus-plus.org/download/">http://notepad-plus-plus.org/download/</a></span></li>
<li><span style="font-family: Verdana, sans-serif;">The latest version of Cygwin from <a href="http://www.cygwin.com/setup.exe">http://www.cygwin.com/setup.exe</a></span></li>
</ul>
<div>
<h2>
<span style="font-family: Trebuchet MS, sans-serif;">Installation</span></h2>
<span style="font-family: Verdana, sans-serif;"><br /></span>
<span style="font-family: Verdana, sans-serif;">Install the JDK, Cygwin and notepad++ to their default locations. Extract or install the Android SDK, NDK and Cocos2D to the C:\Andriod Folder. Here's how my C:\Android Folder looks like.</span><br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEik2JMX9TqKabI3BMnBXd0T8W1iwjeeh5Ywo2uroxAq0aqtNVOyetFdK6QTO042Y_PEnLYHWg9gCdKXNLD88mEuaT9cTsPZsN7GTYaN9sym0vr2RQw9zO-Q9K3jIj7CYUc2V4Aw0h2F0qA/s1600/extract.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="203" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEik2JMX9TqKabI3BMnBXd0T8W1iwjeeh5Ywo2uroxAq0aqtNVOyetFdK6QTO042Y_PEnLYHWg9gCdKXNLD88mEuaT9cTsPZsN7GTYaN9sym0vr2RQw9zO-Q9K3jIj7CYUc2V4Aw0h2F0qA/s640/extract.JPG" width="640" /></a></div>
<br />
<span style="font-family: Verdana, sans-serif;"><br /></span>
<span style="font-family: Verdana, sans-serif;">When installing Cygwin, make sure you search and add these packages:</span><br />
<span style="font-family: Verdana, sans-serif;"><br /></span>
<span style="color: red; font-family: Verdana, sans-serif;">autoconf, automake, binutils, gcc-core, gcc-g++, gcc4-core, gcc4-g++, gdb, pcre, pcre-devel, gawk, make</span><br />
<span style="color: red; font-family: Verdana, sans-serif;"><br /></span>
<br />
<h2>
<span style="font-family: Trebuchet MS, sans-serif;">Setting up Cygwin</span></h2>
</div>
<div>
<span style="font-family: Verdana, sans-serif;"><br /></span></div>
<div>
<span style="font-family: Verdana, sans-serif;">Edit the batch file <span style="background-color: white; color: #484848;"> </span><span style="background-color: white; color: #484848;">create-android-project.bat using notepad++ (right-click on it in Windows Explorer)</span></span></div>
<div>
<span style="font-family: Verdana, sans-serif;"><br /></span></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgvpiW-yhVkUGP-gTJhc6IeQSNGQ1vObhUut8FXqIadvwOI86ycBfRhLLJ5mGXPKaEUUoEHkFc8gp96A4RHQrIqKxQ2VgXpD6eneAQpZkwMASHmsvfYvxpDdk9gsFe8KUoNDNdyqxkh1dk/s1600/edit+bat.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="640" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgvpiW-yhVkUGP-gTJhc6IeQSNGQ1vObhUut8FXqIadvwOI86ycBfRhLLJ5mGXPKaEUUoEHkFc8gp96A4RHQrIqKxQ2VgXpD6eneAQpZkwMASHmsvfYvxpDdk9gsFe8KUoNDNdyqxkh1dk/s640/edit+bat.png" width="604" /></a></div>
<br />
<div class="separator" style="clear: both; text-align: left;">
<span style="font-family: Trebuchet MS, sans-serif;">Edit _CYGBIN, _ANDROIDTOOLS and _NDKROOT values in the batch file depending on your environment. If you followed what I did, use the configuration below:</span></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="font-family: Trebuchet MS, sans-serif;"><br /></span></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg0d2YSNfx6Guw2xGY4r4AoTTL5xE_yPEDwq4dcmMVrmE2aq43GJbK2qDUg12ZkiPInCO8f-jvjeI3yVs7NQt8HsmjpcGY67SRaigVdfSqxtUZossFf8FgGU3Q-1sKL-wNbN18AKL5qBUY/s1600/editfile.PNG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="168" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg0d2YSNfx6Guw2xGY4r4AoTTL5xE_yPEDwq4dcmMVrmE2aq43GJbK2qDUg12ZkiPInCO8f-jvjeI3yVs7NQt8HsmjpcGY67SRaigVdfSqxtUZossFf8FgGU3Q-1sKL-wNbN18AKL5qBUY/s640/editfile.PNG" width="640" /></a></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="font-family: Trebuchet MS, sans-serif;"><br /></span></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="background-color: white; color: #484848; font-family: Verdana, sans-serif; font-size: 12px;">Add the following Environment Variable in the end of file home\<youname>\.bash_profile</span></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="background-color: white; color: #484848; font-family: Verdana, sans-serif; font-size: 12px;"><br /></span></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="background-color: white; font-size: 12px;"><span style="font-family: Verdana, sans-serif;"></span></span></div>
<div class="separator" style="clear: both;">
<span style="font-family: Verdana, sans-serif;"><span style="color: red;">NDK_ROOT=/cygdrive/C/Android/android-ndk-r8e</span></span></div>
<div class="separator" style="clear: both;">
<span style="font-family: Verdana, sans-serif;"><span style="color: red;"><br /></span></span></div>
<div class="separator" style="clear: both;">
<span style="font-family: Verdana, sans-serif;"><span style="color: red;">export NDK_ROOT</span></span></div>
<div class="separator" style="clear: both; color: #484848;">
<span style="font-family: Verdana, sans-serif;"><br /></span></div>
<div class="separator" style="clear: both; color: #484848;">
<span style="font-family: Verdana, sans-serif;">Restart Cygwin.</span></div>
<div class="separator" style="clear: both; color: #484848;">
<span style="font-family: Verdana, sans-serif;"><br /></span></div>
<h2>
<span style="font-family: Verdana, sans-serif;">Executing the Batchfile</span></h2>
<div class="separator" style="clear: both; color: #484848;">
<span style="font-family: Verdana, sans-serif;"><br /></span></div>
<div class="separator" style="clear: both; color: #484848;">
</div>
<span style="font-family: Verdana, sans-serif;">Execute the batch from the windows explorer. It will ask you for the project location, set it (something like com.yourproject.something), and then choose the project name and target ID. This will create a folder with the project name inside the cocos2dx installation folder. You should see the execution of a script, without any error, something like this:</span><br />
<div>
<span style="font-family: Verdana, sans-serif;"><br /></span></div>
<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhzXp7-YbzVtK4mMDXaySyaVq_0ZNuFDP_Rw0kbqtqov6WziN6iEHi3QGObDB6Cc_r5Y29liP6iIVCU2GXIwpkqIuT5HLCCbRbWWLg2fBOnH9bhyHHBwd_HWrKsGQB0JRRn_giG-oNCnbQ/s1600/createhelloworld.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="419" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhzXp7-YbzVtK4mMDXaySyaVq_0ZNuFDP_Rw0kbqtqov6WziN6iEHi3QGObDB6Cc_r5Y29liP6iIVCU2GXIwpkqIuT5HLCCbRbWWLg2fBOnH9bhyHHBwd_HWrKsGQB0JRRn_giG-oNCnbQ/s640/createhelloworld.png" width="640" /></a></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="font-family: Trebuchet MS, sans-serif;"><br /></span></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="font-family: Trebuchet MS, sans-serif;"><b>To be continued....</b></span></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="font-family: Trebuchet MS, sans-serif;"><br /></span></div>
Zeratulhttp://www.blogger.com/profile/15502878100405106115noreply@blogger.com0tag:blogger.com,1999:blog-6437406564116194332.post-83165177255474913992013-03-25T17:39:00.003-07:002013-03-25T17:39:56.023-07:00IntroductionHi,<br />
<br />
I will post things that I've learned over time as an Independent Developer. Take note, developing software solutions and games is just my hobby.<br />
<br />
Thank you,<br />
HomerZeratulhttp://www.blogger.com/profile/15502878100405106115noreply@blogger.com0