[cocos2d-x JSB]Communicate with Cpp and Javascript easily - EasyJSB

Wrote date︰2014/01/16 10:40
cocos2d-x used version︰2.2.2
Data from︰小鰻的cocos2d-x學習筆記

如果您是中文用戶,請切換至此篇文章。

1. Before

Writing cross-platform project by Javascript usually need take a lot of time to communicate with Cpp and native(iosAndroid). The developer have to learn how to use parameter or method within SpiderMonkey by JSB-binding to approach this task.

It is painful the developer have to learn SpiderMonkey(ps.1) and is time-consuming. So EasyJSB  born!

EasyJSB is based on EasyNDK, you need to understand how to use EasyNDK as possible.






[ps.1]
SpiderMonkey is Mozilla's Javascript engine written in C/C++. It is used in various Mozilla products, including Firefox. For the target of building one game to cross-platform, cocos2d-x team binding C++ to javascript to let Javascript developers can use Cocos2d-x easily.

2. Start

Step1 Download EasyJSB from Github

Go to Github and download EasyJSB library or go to the path cocos2dx\projects and input command under terminal as below:
$git clone https://github.com/lp43/EasyJSB.git

Open EasyJSB Project in Xcode

Take about ten minutes,
the project download done.
You can open Xcode project under proj.ios folder directly.

Open EasyJSB Project in Eclipse


When you imported the project,
you will see EasyJsbSample in your eclipse workspace.
Remove all files under obj folder and rebuild project,
you will see how EasyJSB work on Android。

3 則留言 :

  1. 很感谢你开发了这个easyjsb和easynsk, 我用这两个在我的游戏里。 现在cocos2d v3 出来了, 请问可以支持v3 吗?期待着v3支持的版本。

    回覆刪除
  2. 您好,
    很高興聽到您使用我開發的套件,
    由於EasyNDK是另位作者開發,
    且EasyJSB是架構在EasyNDK之上,
    v3大部份需更改的Code都是EasyNDK裡面的工程,
    可能要麻煩您去問EasyNDK作者,
    待他改版完後我這裡尚可進行改版工程。

    抱歉。

    回覆刪除
  3. Trying to find the most reputable online casino? Join The Best Casino.

    回覆刪除