• Stars
    star
    151
  • Rank 246,057 (Top 5 %)
  • Language
    Python
  • Created over 11 years ago
  • Updated over 2 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

cocos2d command line tool

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

More Repositories

1

cocos2d-x

Cocos2d-x is a suite of open-source, cross-platform, game-development tools utilized by millions of developers across the globe. Its core has evolved to serve as the foundation for Cocos Creator 1.x & 2.x.
C++
18,090
star
2

cocos2d-objc

Cocos2d for iOS and OS X, built using Objective-C
Objective-C
4,070
star
3

cocos2d-html5

Cocos2d for Web Browsers. Built using JavaScript.
JavaScript
3,055
star
4

cocos2d-js

cocos2d-x for JS
C++
1,858
star
5

CocosBuilder

CocosBuilder, the visual editor for cocos2d
Objective-C
1,012
star
6

cocos2d-iphone-extensions

3rd party extensions for cocos2d-iphone
Objective-C
638
star
7

cocos2d-x-samples

Contains different cocos2d-x samples
Python
575
star
8

creator_to_cocos2dx

Creator plugin to support C++& Lua in cocos2d-x
C++
234
star
9

cocos2d-x-3rd-party-libs-bin

C
197
star
10

cocos2d-js-tests

cocos2d JavaScript test cases and games.
JavaScript
187
star
11

bindings-generator

JSBindings generator for C++
Python
168
star
12

cocos2d-x-extensions

samples games & code snips for cocos2d-x
C++
152
star
13

cocos2d-x-3rd-party-libs-src

Dependencies of cocos2d-x.
Perl
140
star
14

cocos2d-x-for-xna

port cocos2d-x into c# based on XNA
C#
123
star
15

cocos2d-x-docs

documentation of cocos2d-x
HTML
102
star
16

cocos2d-objc-ext

Extensions and utility classes for Cocos2D-iphone
Objective-C
58
star
17

cocos2d-iphone-classic

Repository of original V1 and V2 of Cocos2D-iphone
Objective-C
47
star
18

cocos2d-frame

Player and "stub" for cocos2d
C
37
star
19

cocos2d-js-samples

Includes different samples to be used with cocos2d
JavaScript
36
star
20

cocos2d-x-swift-bindings

Swift bindings for cocos2d-x
Objective-C++
32
star
21

cocos2d-x-external

use CMake to build external 3rd party modules for cocos2d-x
C
18
star
22

cocos2d-js__old__

cocos2d in JavaScript central repository
JavaScript
14
star
23

js-bindings

C++
13
star
24

cocos2d-x-classic

For full history commit logs of cocos2d-x
C
8
star
25

v8

V8 building
Python
7
star
26

migration-demo-objc

The Objective-C flavoured version of migration-demo-x
Objective-C
6
star
27

migration-demo-x

Demonstrates -obj to -x project migration
C++
5
star
28

console-binary

The binary files for cocos2d-console
4
star
29

cocos2d-x-docs-deps

Dependencies of building cocos2d-x docs
Shell
2
star
30

cocos2d.github.io

1
star