O'Reilly logo

Cocos2d-x Cookbook by Akihiro Matsuura

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Using the Cocos command

The next step is using the cocos command. It is a cross-platform tool with which you can create a new project, build it, run it, and deploy it. The cocos command works for all Cocos2d-x supported platforms and you don't need to use an IDE if you don't want to. In this recipe, we take a look at this command and explain how to use it.

How to do it...

  1. You can use the cocos command help by executing it with the --help parameter, as follows:
    $ cocos --help
    
  2. We then move on to generating our new project:

    First, we create a new Cocos2d-x project with the cocos new command, as shown here:

    $ cocos new MyGame -p com.example.mygame -l cpp -d ~/Documents/
    

    The result of this command is shown the following screenshot:

    Behind the new parameter ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required