GithubHelp home page GithubHelp logo

king6cong / cocos2d-console Goto Github PK

View Code? Open in Web Editor NEW

This project forked from cocos2d/cocos2d-console

0.0 3.0 0.0 79.92 MB

cocos2d command line tool

Python 62.63% Shell 0.05% Batchfile 0.02% C++ 0.60% Csound Document 0.90% JavaScript 0.19% Lua 35.55% Makefile 0.06%

cocos2d-console's Introduction

cocos2d-console

Download

$ NOT DONE YET

Install

$ NOT DONE YET

Vision of cocos2d-console

A command line tool that lets you create, run, publish, debug, etc… your game. It is the swiss-army knife for cocos2d.

This command line tool is in its early stages.

Examples:

# starts a new project called "My Game" for multi-platform

$ cocos new MyGame -l cpp -p org.cocos2d.mygame

$ cd MyGame

# Will deploy the project to device and run it
$ cocos run -p android


Devel Info

Internals

cocos.py is an script whose only responsability is to call its plugins. cocos.bat will invoke cocos.py on windows cocos will invoke cocos.py on Mac OS X and linux

To get a list of all the registered plugins:

$ cocos

To run the "new" plugin:

$ cocos new

Adding a new plugin to the console

You have to edit bin/cocos2d.ini, and add the class name of your new plugin there. Let's say that you want to add a plugin that deploys the project:

# should be a subclass of CCPlugin
project_deploy.CCPluginDeploy

And now you have to create a file called project_deploy.py in the plugins folder. A new, empty plugin, would look like the code shown below:

import cocos

# Plugins should be a sublass of CCPlugin
class CCPluginDeploy(cocos.CCPlugin):

		# in default category
        @staticmethod
        def plugin_category():
          return ""

        @staticmethod
        def plugin_name():
          return "deploy"

        @staticmethod
        def brief_description():
            return "Deploy the project to target."                

        def run(self, argv, dependencies):
            print "plugin called!"
            print argv

Plugins are divided by category, depending on it's function: project, engine, ...

The plugins of project is in default category, it's an empty stirng "".

Generate Executable

Now you can use the toexec/build_console.py for generating a executable file of cocos command.

Environment Requirement

  • Python 2.7 (2.7.5 is well tested)
  • PyInstaller (PyInstaller 2.1 is well tested)
  • Necessary PATH environment for python & pyinstaller.

Attention:To keep compatible with both Windows-32bit & Windows-64bit, please install 32bit python on Windows.

Steps

Run python build_console.py in command line. Then the executable file & necessary files will be generated in toexec/output/PLATFORM.

The usage of build_console.py:

usage: build_console.py [-h] [-s SRC_PATH] [-d DST_PATH]

Generate executable file for cocos2d-console by PyInstaller.

optional arguments:
  -h, --help            show this help message and exit
  -s SRC_PATH, --src-path SRC_PATH
                        Specify the path of cocos2d-console.
  -d DST_PATH, --dst-path DST_PATH
                        Specify the path of output.

Using the Executable

The generated executable files can replace the source code of cocos2d-console.

To fit the limitation of the cocos2d-console implementation. The generated executable files should located at ENGINE_PATH/tools/cocos2d-console/bin.

Then you can use the executable file as same as the source code.

Commands Required

Please see this issue

cocos2d-console's People

Contributors

bofeng-song avatar bunnyhero avatar chuanweizhang2013 avatar darkdukey avatar dingpinglv avatar dualface avatar duhaibo0404 avatar edwardzhou avatar geron-cn avatar hugohuang1111 avatar hylthink avatar idvincentyang avatar leafsoar avatar lihe757 avatar lihex avatar luisparravicini avatar minggo avatar pandamicro avatar ricardoquesada avatar samuele3hu avatar samuele3hu2022 avatar slackmoehrle avatar sunlightjuly avatar thenewvu avatar wenhailin avatar xiaofeng11 avatar xpol avatar yangws avatar yycdef avatar zilongshanren avatar

Watchers

 avatar  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.