LWF for C++ with Cocos2d-x renderer

We are happy to announce releasing LWF for C*+ with Cocos2d-x renderer!

LWF is a framework for 2D User Interface and 2D Animation. It is based on an animation data converted from an Adobe Flash SWF file. GREE, Inc. already released LWF for Unity, HTML5 and of course, Cocos2d-html5.
Using Gree’s SWF with cocos2d-html5 in HTML5 forum thread.

LWF for HTML5 demo http://gree.github.io/lwf-demo/html5/lwf-loader/sample3.html
Please take a look at the presentation for the detail of LWF.
http://gree.github.io/lwf/presentation20121115
And then, finally, we are releasing LWF for C*+ and Cocos2d-x renderer! It’s under the zlib License.
* LWF for C*+
* LWF Cocos2d-x renderer
* LWF Lua binding
LWF for C*+ does not depend on any game engine or environment but only C03 and C03 standard library. And LWF Cocos2d-x renderer depends on Cocos2d-x 3.0alpha1 or later. We don’t have any plan for supporting Cocos2d-x 2.x. LWF Lua binding isn’t intend to use only on Cocos2d-x Lua binding, you can use it with Cocos2d-x C++ project.

LWF is easy to use with Cocos2d-x.

LWFNode *lwfNode = LWFNode::create(“sample.lwf”);
this->addChild(lwfNode);

For further information, please visit the project GitHub page at http://gree.github.io/lwf/ , I hope we will soon add more samples and documents.

Happy Holidays and Hacking!

1 Like

Uploaded a sample.
* https://github.com/splhack/Hello-LWF-Cocos2d-x/
* https://github.com/splhack/Hello-LWF-Cocos2d-x/tree/master/projects/Hello-LWF-Cocos2d-x

Nice, i hope it support Additive Blending, Mask for cocos2d-x

Blue Wind wrote:

Nice, i hope it support Additive Blending, Mask for cocos2d-x

Thanks, we’ll support Additive Blending soon, and consider how to implement Mask.

Thanks. This is a great feature!

Ricardo Quesada wrote:

Thanks. This is a great feature!

Thanks! :slight_smile:

And we updated LWF for supporting Additive Blending! LWF sees the value “add” of “Blending” parameter in Adobe Flash.

Thanks, nice framework :smiley:

Can you tell me how to convert SWF file to LWF?

hiram xu wrote:

Can you tell me how to convert SWF file to LWF?

Please take a look at LWF Production Guide and Install LWFS . It automatically converts swf files to lwf files in ~/Desktop/LWFS_work folder and shows the data on Web browser.

We updated LWF and Hello-LWF-Cocos2d-x for Cocos2d-x 3.0beta!
Have fun!

Can you add project for win32?

Got stuck when I want to install rb-img. I don’t know how to install libpng, libjpeg, and libxml for Devkit on windows. Is there a tutorial on how to do it?

And is there texture atlas generator on lwf? or we should do it manually with texturepacker?

Thanks

Blue Wind wrote:

Can you add project for win32?

Sorry I don’t have any Windows. But LWF should work with Windows, it’s worth a try to create your own project.

Herman To wrote:

Got stuck when I want to install rb-img. I don’t know how to install libpng, libjpeg, and libxml for Devkit on windows. Is there a tutorial on how to do it?

Have you tried to install Windows binary from https://github.com/gree/lwfs ? It’s easy to use for converting Flash data.

And is there texture atlas generator on lwf? or we should do it manually with texturepacker?

We want to integrate launching TexturePacker command line tool from LWFS, but in the meantime, you have to do it manually using GUI or command line tool as the following.

texturepacker --format json --shape-padding 0 --border-padding 0 --padding 0 --inner-padding 0 --no-trim --maxrects-heuristics best --disable-auto-alias --reduce-border-artifacts --trim-mode Trim --scale 1 --extrude 1 --data sample_data_atlas.json --sheet sample_data_atlas.png ~/Desktop/LWFS_work/sample_data/sample_data.bitmap/*.png

Added LWF in Cocos2d-x Hub! http://www.cocos2d-x.org/hub/103

I tried LWFS and it works perfectly

I can’t get github’s LWF cocos-2dx codes to work on Windows. There are a lot of ambiguous naming error. Is it omitted in mac?

So, I tried to fix them, everything compiles, but I got error when linking

1>lwf_cocos2dx_node.obj : error LNK2019: unresolved external symbol “public: class boost::shared_ptr *thiscall cocos2d::LWFResourceCache::loadLWFData" referenced in function "public: virtual class boost::shared_ptr*thiscall cocos2d::LWFNode::attachLWF(class std::basic_string<char,struct std::char_traits,class std::allocator >,char const ,char const)” (?attachLWF@LWFNode@cocos2d@UAE?AV?$shared_ptrVLWF@1@boost``V?$basic_stringDU?$char_traits@D@std@V?$allocatorD@2@std``PBD1Z)
1>lwf_cocos2dx_node.obj : error LNK2019: unresolved external symbol “public: void thiscall cocos2d::LWFResourceCache::unloadLWFData" referenced in function "public: virtualthiscall cocos2d::LWFNode::~LWFNode(void)” (??1LWFNode@cocos2d@UAEXZ)

I double checked everything and I think there is nothing missing between declaration and definition. Any solution?

I think it is caused by the same name between namespace and class name?

I can’t fix it, there are lots of errors if I’m trying to change LWF class name to LWFCore

Is there a better solution for windows user?

Hmm, at least, if your compiler supports C++11, LWF doesn’t use boost at all. So ‘unresolved external symbol "public: class boost::shared_ptr’ seems odd. What compiler are you using?

I’m using VS2012. It’s solved now, I changed LWF class to LWFCore. I think the compiler confused between LWF class name and LWF namespace since intellisense can’t find implementation for loadLWFData and unloadLWFData.

I got another question, is there convenient way to support batching with texture atlas generated from Texturepacker? I tried this code :

LWFNode lwfNode = LWFNode::create;
SpriteBatchNode
batch = SpriteBatchNode::createWithTexture(lwfNode~~>getTexture);
batch~~>addChild(lwfNode);
this~~>addChild;
Then I got assert
Expression: childSprite~~>getTexture()>getName == _textureAtlas>getTexture()->getName()

Any thoughts? I’m currently trying to implement using SpriteFrameCache