cocos2d-x README

The project's README from github.com/cocos2d/cocos2d-x. As one markdown file: README.md.

cocos2d-x

Win32 Others
Build status Build Status

cocos2d-x is a multi-platform framework for building 2d games, interactive books, demos and other graphical applications. It is based on cocos2d-iphone, but instead of using Objective-C, it uses C++. It works on iOS, Android, macOS, Windows and Linux.

Cocos2d-x Framework Architecture:

cocos2d-x is:

Git user attention

  1. Clone the repo from GitHub.

      $ git clone https://github.com/cocos2d/cocos2d-x.git
    
  2. After cloning the repo, please execute download-deps.py to download and install dependencies.

      $ cd cocos2d-x
      cocos2d-x $ python download-deps.py
    
  3. After running download-deps.py.

      cocos2d-x $ git submodule update --init
    

Download stable versions

Documentations and samples

Main features

Build Requirements

Runtime Requirements

Environment Setup

Should set up environment before starting a new game or running tests

$ cd cocos2d-x
$ ./setup.py
$ source FILE_TO_SAVE_SYSTEM_VARIABLE

Should invoke this script if using linux system

$ cd cocos2d-x
$ ./install-linux-deps.sh

Running Tests

$ cd cocos2d-x
$ mkdir build
$ cd build
$ cocos run --proj-dir .. -p [mac|win32|android|linux|ios]

How to start a new game

$ cd cocos2d-x
$ ./setup.py
$ source FILE_TO_SAVE_SYSTEM_VARIABLE
$ cocos new MyGame -p com.your_company.mygame -l cpp -d NEW_PROJECTS_DIR
$ cd NEW_PROJECTS_DIR/MyGame
$ mkdir build
$ cd build
$ cocos run --proj-dir .. -p [mac|win32|android|linux|ios]

You can also create a Lua project with -l lua.

Using IDE

If need to debug program, then it is more convinent to use IDE to run and debug it. All platforms other than Android can use CMake to generate corresponding project file. Can refer to Detail CMake Guide for detail information.

For Android, the Android Studio project file lies in PROJECT_DIR/proj.android. Can just use Android Studio to import the exsting project file.

Learning Resources

Spreading the word!

You can help us spread the word about cocos2d-x! We would surely appreciate it!

Where to get help

Contributing to the Project

Cocos2d-x is licensed under the MIT License. We welcome participation!

Did you find a bug? Do you have feature request? Do you want to merge a feature?

Embrace the Future: Switch to Cocos Creator for a Better Experience

Cocos Creator is the new generation of Cocos game engine with a full featured editor and content creation friendly workflow. It supports all major platforms allowing games to be quickly released for the web, iOS, Android, Windows, Mac, and various mini-game platforms. Millions of developers have built 2D / 3D experiences, from hardcore games to web instant entertainment. A pure JavaScript-developed engine runtime is available on the web and mini-game platforms for better performance and smaller packages. On other native platforms, C++ is used to implement the underlying framework, providing greater operational efficiency. The engine is completely open source, and retains the advantages of Cocos2d-x which includes high performance, customizability, ease for debugging, easy to learn, and small package size.

Therefore, we no longer recommend new users to start with Cocos2d-x. Instead, please use the brand-new Cocos Creator for project development to enjoy the best editor and 3D support.

cocos2d-x (cocos2d/cocos2d-x)

Searching Database…

19.2K ·GitHub
这是什么?一个开源、跨平台的 C++ 框架,用来开发 2D 游戏、互动图书、演示程序和其他图形应用——它最初是 cocos2d-iphone 的 C++ 移植版,支持 iOS、Android、macOS、Windows 和 Linux。
它是一个完整的游戏引擎,还是需要我自己拼装的底层库?是一个完整的 2D 引擎:带场景切换的场景管理、精灵和精灵图集、动作与缓动系统、基础菜单和按钮、瓦片地图、视差滚动以及声音引擎。你以一组场景的形式来搭建游戏。
我怎样才能把第一个游戏跑起来?克隆仓库,运行 'python download-deps.py' 和 'git submodule update --init',然后运行 './setup.py'。用 'cocos new MyGame -p com.yourcompany.mygame -l cpp -d NEWPROJECTSDIR' 创建项目,再用 'cocos run --proj-dir .. -p mac' 运行。
在这些步骤之前,我的电脑上需要装好什么?需要 Python 2.7.5+——README 明确说明不能用 Python 3。各平台要求:macOS 上需要 Xcode 8+,Windows 上需要 VS 2015,Linux 上需要 CMake 3.1+;做 Android 开发需要 NDK r16+ 和 Android Studio 3.0.0+;发布 Web 版需要 JRE 或 JDK 1.6+。
在花时间投入之前,有什么坑我该知道的?README 本身已不再推荐用 cocos2d-x 开发新项目——团队引导新用户改用 Cocos Creator,而且两个引擎的 API 不一样,已有经验无法直接迁移。
我做完的游戏能在哪些平台上运行?按运行环境要求:iOS 8.0+、Android 3.0.0+、OS X v10.9+ 和 Windows 7+。开发本身支持在 macOS、Windows 和 Linux(Ubuntu 14.04+)上进行。
我可以用它发布闭源的商业游戏吗?可以——Cocos2d-x 采用 MIT 许可证,明确对商业使用友好,兼容开源和闭源项目。
我的游戏可以用哪些物理引擎?Box2d 和 Chipmunk 都已内置开箱即用,另外还内置了粒子系统,并可通过 Spine 和 Armature 支持骨骼动画。
它底层用什么来渲染?移动端用 OpenGL ES 2.0,桌面端用 OpenGL 2.1,macOS 和 iOS 上还支持 Metal。
cocos2d-x 和 Cocos Creator 是什么关系?cocos2d-x 的核心后来成了 Cocos Creator 1.x 和 2.x 的基础;Creator 是更新的、以编辑器为主并支持 3D 的引擎,而 cocos2d-x 仍是经典的以 C++ 代码为核心的引擎。
What are similar projects?bgfx, flame, assimp, luanti, JoltPhysics, ebiten, imgui, libgdx
Creator
cocos2d
Size
1 GB
Stars
19.2K
Updated
CommitNov 20
Age
15y
Commits · 90 Days