Cocos2D Start

Architecture and Directory Structure

1. Cocos2d-x

1.1 Architecture

1.2 Directory StructureThis document is describing the folder structure of cocos2d-x v3.0-alpha1 and later.

After you download cocos2d-x repo from github, or unzip a stable release zip ball, you will see the directory structure like this:

DirectoryExplain
buildThis folder includes top level xcode projects, visual studio solutions and makefiles
cocosThis is the major directory for cocos2d-x framework.
docsYou can download doxygen, use it to open doxygen.config file in this this folder, then generate offline API docs by yourself
extensionsThis folder is almost deprecated after v3.0. Please use cocos/gui instead of extensions/GUI, use cocos/physics instead of extension/physics-nodes. Assets-manager can work but will be refactor sooner
externalHere are all 3rd libraries which is dependencied by cocos2d-x
licensesCocos2d depends on many other open source projects. All of their licenses are here. We've avoid all GPL/LGPL libraires, so cocos2d-x and its dependencies are commercial friendly.
samplesIMPORTANT. This is where you should start from. Cpp/HelloCpp can be your first lesson, and you can find the usages of all classes in TestCpp. Looking for lua and js samples? They’re also here.
templateHere're templates for creating cocos2d-x new project in different IDEs and various platforms.
toolsLots of different command line tools, such as createing new projects, binding c++ to lua to javasript, compile javascript into bytecode, etc. We're refactoring this into cocos-console.

2. Cocos2d-html5

2.1 Architecture

2.2 Directory Structure

DirectoryExplain
CocosDenshionAudio support. Note that you need at least two audio formats to support all browsers
cocos2dMain directory, contains everything and maintains API the same as Cocos2d-x and Cocos2d-iPhone. The platform compatibility is well designed, enjoy it
box2dBox2dweb Physics engine v2.1a
chipmunkChipmunk Physic engine with no version number, ;)
DemoThere are couples demos which you may get started from them
extensionsIf you looking for more GUI controls, EditBox, CocosBuilder support, CocoStudio support, or any third party libs, that’s where it is
HelloHTML5WroldAn advance Hello World for you to get started
libIt contains a min version engine when you run /cocos2d/build.xml with ant tool to package all engine flies to a single file
licensesCocos2d depends on many other open source projects. All of their licenses are here
samplesYou can find all classes usage in Tests. It also includes sample games. All the tests and games can be run in JSB.IMPORTANT. This is where you should start from
templatetemplates for creating a new Cocos2d-html5 project
toolsJSDoc and Closure Compiler
index.htmlIndex of Cocos2d-html5
AUTHORSList of all contributors
CHANGELOGWell, it lists changes that above guys have done

3. Javascript Binding

Crossing platform is good, but not good enough. Programming in C++ is super slow, in the other hand, C++ code cannot run on web browsers. That’s why we add javascript binding. We can pack javascript code into:

  • native app on cocos2d-x + SpiderMonkey, which can parse javascript code into C.
  • web app on cocos2d-html5

We have a same API set on cocos2d-x and cocos2d-html5. Therefore, we can create 100% javascript game natively in cocos2d-x. When you want to run it on browsers, want you need is only switch engine to cocos2d-html5, without modifying your source code.

The benefits are:

  • Much faster coding speed than c++
  • Don’t need to deal with wild pointers / reference count / memory leak
  • Crossing both native and web
  • Online updating

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值