Game Development Reference
In-Depth Information
Time for action - creating an application
Open Terminal again and follow these easy steps:
1. You should have the path to the Cocos2d-x console already added to your system.
You can test this by using the
cocos
command inside Terminal. In order to create
a new project called
HelloWorld
, using C++ as its primary language and save it
on your desktop, you need to run the following command, replacing
YOUR_BUNDLE_INDETIFIER
with a package name of your choice, and repla-
cing
PATH_TO_YOUR_PROJECT
with the path to wherever you wish to save
your project:
cocos new HelloWorld -p YOUR_BUNDLE_IDENTIFIER -l cpp
-d PATH_TO_YOUR_PROJECT
2. As an example, in my machine this is the line I typed:
cocos new HelloWorld -p com.rengelbert.HelloWorld -l
cpp -d /Users/rengelbert/Desktop/HelloWorld
And hit
Enter
. If you choose not to give a directory parameter
(-d
), the Cocos
console will save the project inside the
Cocos2d-x
folder.
3. Now you can go to your desktop, or wherever you chose to save your project, and
navigate to the folder
proj.ios_mac
inside the
HelloWorld
project. Inside
that folder you'll find the Xcode project file. Once you open the project inside
Xcode, you can click the
Run
button and you're done.