Integrate Smartfox to cocos2d-js

Post here your questions about the HTML5 / JavaScript for SFS2X

Moderators: Lapo, Bax

caldelta
Posts: 7
Joined: 11 Aug 2015, 04:13
Location: Viet Nam
Contact:

Integrate Smartfox to cocos2d-js

Postby caldelta » 03 Aug 2016, 09:53

Hello,

I am going to integrate smartfox to cocos2d-js, but i face some issues need to make clear.

Currently, i have successful intergate smartfox to cocos2d-x ( using c++ client api)

Now I need integrate it to cocos2d-js too. My expectation is I only need to write ONCE by javascript and able to compile on 3 platform html5, android and ios.

Cocos2d-js provide a solution to binding Js to C++, but SmartFox using boost library which is so complicate for binding-generator ( I guess so). I stuck on binding boost lib just now.

I know many people here are success to integrate it. Please help with with some advice or a right direction. Thank you!

Best regards,
User avatar
Lapo
Site Admin
Posts: 23008
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: Integrate Smartfox to cocos2d-js

Postby Lapo » 03 Aug 2016, 14:28

Hi,
if you're using Cocos2D-JS you should also use our Javascript client library. Not the C++ one.

You can go to our main download page, and download it:
http://smartfoxserver.com/download/sfs2x#p=client

The library is written in pure javascript and works very similarly to the other SmartFoxServer API. I would also recommend downloading our HTML5 Example Pack here:
http://smartfoxserver.com/download/sfs2x#p=examples

The Javascript documentation is found here:
http://docs2x.smartfoxserver.com/api-docs/jsdoc/

cheers
Lapo
--
gotoAndPlay()
...addicted to flash games
caldelta
Posts: 7
Joined: 11 Aug 2015, 04:13
Location: Viet Nam
Contact:

Re: Integrate Smartfox to cocos2d-js

Postby caldelta » 04 Aug 2016, 02:16

Hi there,

How about 2 native: android and ios but use javascript as the developing language?
User avatar
Lapo
Site Admin
Posts: 23008
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: Integrate Smartfox to cocos2d-js

Postby Lapo » 04 Aug 2016, 05:14

Hi,
I am not an expert of Cocos2D-JS specifically, but the idea is that Cocos allows you to write your code in Javascript and then will compile your project for various platforms, including iOS and Android. Right?

If this is correct then our HTML5/JS library is pure Javascript code so it can compiled, along with your game JS code, to any of the platforms supported by Cocos2D-JS.

At least this is what I understand from this page:
http://www.cocos2d-x.org/wiki/Cocos2d-JS

cheers
Lapo

--

gotoAndPlay()

...addicted to flash games
caldelta
Posts: 7
Joined: 11 Aug 2015, 04:13
Location: Viet Nam
Contact:

Re: Integrate Smartfox to cocos2d-js

Postby caldelta » 04 Aug 2016, 10:09

Yes, HTML5/JS library is pure Javascript therefore It is only work on WEB not on NATIVE Android and iOS.

Cocos2d-js provide a mechanism called "jsb" allow javascript call native API.

I wonder if i could use JSB to call native API of smartfox too ?
User avatar
Lapo
Site Admin
Posts: 23008
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: Integrate Smartfox to cocos2d-js

Postby Lapo » 04 Aug 2016, 14:08

Yes, I suppose that is possible.
Lapo

--

gotoAndPlay()

...addicted to flash games
caldelta
Posts: 7
Joined: 11 Aug 2015, 04:13
Location: Viet Nam
Contact:

Re: Integrate Smartfox to cocos2d-js

Postby caldelta » 05 Aug 2016, 04:13

Do you have plan to support it officially ? :(
User avatar
Lapo
Site Admin
Posts: 23008
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: Integrate Smartfox to cocos2d-js

Postby Lapo » 05 Aug 2016, 06:55

I am not sure what you mean by that. If Cocos2D-JS can call native code you can use the official C++ API.

Sure the operation sounds a little bit convoluted since you have to write JS code for HTML and then wrap the native API calls... honestly it seems a bit of a convoluted system.

Why not using Cocos2D-x directly for the mobile versions? It seems like an easier process than wrapping all the JS code which calls the native code below... Just my impression.

cheers
Lapo

--

gotoAndPlay()

...addicted to flash games
caldelta
Posts: 7
Joined: 11 Aug 2015, 04:13
Location: Viet Nam
Contact:

Re: Integrate Smartfox to cocos2d-js

Postby caldelta » 05 Aug 2016, 08:39

yes, as you said that is convoluted progress.

By using JSB to allow javascript call native API have some limitations. And the boost library which is not simple C++ library for binding generator already. I was try to binding boost lib C++ first then your "Wrapper Smartfox" . But stuck at "boost binding process".

We intented to use Javascript to save time of developing, only write ONCE LOGIC and compile in various platforms. Of course using cocos2d-x separately is easier process.

Return to “SFS2X HTML5 / JavaScript API”

Who is online

Users browsing this forum: No registered users and 19 guests