- Cocos2d-x Cookbook
- Akihiro Matsuura
- 407字
- 2021-07-09 20:58:46
Installing Cocos2d-x
Getting ready
To follow this recipe, you need to download the zip file from the official site of Cocos2d-x (http://www.cocos2d-x.org/download).
At the time of writing this book, version 3.4 was the latest stable version that was available. This version will be used throughout this book.
How to do it...
- Unzip your file to any folder. This time, we will install the user's home directory. For example, if the user name is
syuhari
, then the install path is/Users/syuhari/cocos2d-x-3.4
. In this book, we call itCOCOS_ROOT
. - The following steps will guide you through the process of setting up Cocos2d-x:
- Open the terminal
- Change the directory in terminal to
COCOS_ROOT
, using the following command:$ cd ~/cocos2d-x-v3.4
- Run
setup.py
, using the following command:$ ./setup.py
- The terminal will ask you for
NDK_ROOT
. Enter intoNDK_ROOT
path. - The terminal will then ask you for
ANDROID_SDK_ROOT
. Enter theANDROID_SDK_ROOT
path. - Finally, the terminal will ask you for
ANT_ROOT
. Enter theANT_ROOT
path. - After the execution of the
setup.py
command, you need to execute the following command to add the system variables:$ source ~/.bash_profile
- We now verify whether Cocos2d-x can be installed:
- Open the terminal and run the
cocos
command without parameters:$ cocos
- If you can see a window like the following screenshot, you have successfully completed the Cocos2d-x install process:
- Open the terminal and run the
How it works...
Let's take a look at what we did throughout the above recipe. You can install Cocos2d-x by just unzipping it. You know setup.py
is only setting up the cocos
command and the path for Android build in the environment. Installing Cocos2d-x is very easy and simple. If you want to install a different version of Cocos2d-x, you can do that too. To do so, you need to follow the same steps that are given in this recipe, but they will be for a different version.
There's more...
Setting up the Android environment is a bit tough. If you recently started to develop Cocos2d-x, you can skip the settings part of Android. and you can do it when you run on Android. In this case, you don't have to install Android SDK, NDK, and Apache ANT. Also, when you run setup.py
, you only press Enter without entering a path for each question.
- Go Web編程
- ClickHouse性能之巔:從架構設計解讀性能之謎
- Pandas Cookbook
- Instant Apache Stanbol
- 動手玩轉Scratch3.0編程:人工智能科創教育指南
- 羅克韋爾ControlLogix系統應用技術
- 機器人Python青少年編程開發實例
- Spring Security Essentials
- MINECRAFT編程:使用Python語言玩轉我的世界
- Python物理建模初學者指南(第2版)
- 自己動手構建編程語言:如何設計編譯器、解釋器和DSL
- Java面試一戰到底(基礎卷)
- R Data Visualization Cookbook
- Python3網絡爬蟲寶典
- Developing Multi:Platform Apps with Visual Studio Code