Cocos2d-html5 alpha 2 released

By linshun Posted 2012-06-20 07:50 Comments 16

We are excited to announce that Cocos2d-html5 alpha 2 is now released!

Since the release of alpha 1, we have received countless valueble feedbacks from the community, we would like to thank you for your active involvement in this project.

So whats new in alpha 2?:)

Google Closure Compiler

The “Advanced mode” is now fully compatible, which means that the Closure Compiler can:

  • Pack your code into single file (including the game engine and your game logic)
  • minifies the code, removing any whitespaces and comments to shrink file size
  • remove unused code, lower memory usage and shrinks file size further
  • obfuscates code, code becomes unreadable, shortens symbols

Overall, the Closure Compiled version runs faster by about 10-20 depending on your code, therefore, we have packaged the shell script to help you compile with GCC. We have updated the testcase, enjoy it: Testcase .

DOM Menu/ui

You can now implement menu and menu items in html DOM with the same cc.Menu API! simply switch “ccMenu.js” and “ccMenuItem.js” files with “ccDomMenu.js” and “ccDomMenuItem.js”
DOM elements have the advantage of not needing to redraw, which is perfect for static ui. In addition, text can be drawn natively which is much faster.
Check out the test cases with dom menu, and try to spot the difference.
One thing to keep in mind is that actions/animations for DOM menu is not yet implemented. Fortunately, this is easily remedied by attaching dom menu to a layer, then run actions & animations on that layer.

API Documentation

We have completed the api documentation, an online version is available here: Documentation.
Documentation was generated by JSDOC-toolkit, we have also packaged a shell script to generate your own documentation if needed.

API Changes

Because our aim is to use the same set of js code to run on Cocos2d-html5 and both Cocos2d-iphone & Cocos2d-x through JS-Binding, a set of unified API is needed.
As the result, only minor API were changed, most notably, all object constructors now uses the keyword “create”.

For example:

var sprite = cc.Sprite.spriteWithFile(s_grossini_dance_atlas, cc.RectMake(x, y, 85, 121)); //is changed to...
var sprite = cc.Sprite.create(s_grossini_dance_atlas, cc.RectMake(x, y, 85, 121));


The next release of Cocos2d-html5 will port the features from Cocos2d-x v2.0.

Stay tuned for further updates!:P


Copyright © 2010 - 2015 Support Email: