Code Monkey home page Code Monkey logo

cocos2d-js's Introduction

cocos2d-js

Cocos2d-JS provides a console tool that makes the development of CH5 and JSB application more simpler and much convenient. You can use it to create a new project, publish it to android, iOS, Mac OS or web, and it's very easy to use.

##Setup

First step, you need to setup before using this tool. Please clone Cocos2d-JS repository and update all submodule. Open console in Cocos2d-JS folder, then just run ./setup.py on console. You may need to provide your NDK, Android SDK and ANT's path during the setup. Note that this tool is developed with python, so you will need python (32bit) 2.7.5 or later installed on your machine (but it doesn't support Python3).

Some useful links:

  • Android SDK

  • NDK

  • Ant binary release

    • Download Ant.
    • Uncompress the downloaded file into a directory.
    • Set environmental variables JAVA_HOME to your Java environment, ANT_HOME to the directory you uncompressed Ant to, and add ${ANT_HOME}/bin (Unix) or %ANT_HOME%/bin (Windows) to your PATH.
    // Example: Execute in console or add into .bash_profile(Mac)
    export ANT_ROOT=/usr/local/ant/bin
    export JAVA_HOME=/usr/local/jdk1.7.0_51
    

##Usage

After setup correctly done, you can start to use cocos command in your console.

###Create a new project

  • Create a project contains Cocos2d-x JSB and Cocos2d-html5:

     cocos new projectName -l js
    
  • Create a project contains Cocos2d-html5 only:

     cocos new projectName -l js --no-native
    
  • Create a project in a specified directory:

     cocos new projectName -l js -d ./Projects
    

###Run the project

  • Run Cocos2d-html5 project with a Websever:

     cd directory/to/project
     cocos run -p web
    
  • Compile and run project in Cocos2d-JSB :

     cd directory/to/project
     cocos compile -p ios|mac|android|web
     cocos run -p ios|mac|android
    
  • Useful options

     -p platform : The platform can be ios|mac|android|web.
     -s source   : Your project directory, if not specified the current directory will be used.
     -q          : Quiet mode, remove log messages.
     -m mode     : Mode debug or release, debug is default
     --source-map: General source-map file. (Web platform only)
    

###Help

And if you have any doubt about the usage, please use -h with any command to have some help messages. Here are all three commands:

  • new for create
  • compile for compile
  • run for run

cocos2d-js's People

Contributors

pandamicro avatar dingpinglv avatar chuanweizhang2013 avatar cocosrobot avatar smallaitt avatar samuele3hu2022 avatar xingsenma avatar minggo avatar lihe757 avatar himynameschris avatar ricardoquesada avatar visualsj avatar hbbalfred avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.