LWF for C++ with Cocos2d-x renderer

how to detect touch with boundingBox?

if (lwfNode->boundingBox().containsPoint(location))
{
log(“lwfNode”);
}

is not working.

@tsl3333 hmm, i’ve never experienced the error.

doc = fl.getDocumentDOM();
lib = doc.library;
var uri = doc.pathURI;

If you don’t save the fla file ever, doc.pathURI will be null. However doc shouldn’t be null at all. I have totally no idea… Have you tried to reboot your computer?

@jamesYou The size of LWFNode is always zero. Thus you can’t use the way. Instead, you can use a button in Flash data. Could you check LWF Production Guide for how to create a button for LWF, and this topic for how to handle events from LWF?

is it impossible touch and drag small object in cpp with other sprite?

jamesYou wrote:

is it impossible touch and drag small object in cpp with other sprite?

@jamesYou possible. you can use MoveMovie or MoveToMovie API for changing the position of a movieclip in Flash data. you can also use directly cocos2d::Sprite for that as well.

possible to flash file use Vector Image ?
or only use bitmap image?

test swf is work well but when i created swf not work.

i use flash cs 6 ver. and publish setting flash player 7 and as 1.0
need more?

@jamesYou

possible to flash file use Vector Image ?
or only use bitmap image?

LWF is intended to use bitmap image only because using vector arts easily make your app laggy. Please take a look at Converting art between vector and bitmap formats.

i use flash cs 6 ver. and publish setting flash player 7 and as 1.0
need more?

Have you tried LWFS? It automatically install “Publish for LWF” command into your Flash CS6. The command adjusts your fla data for LWF. And LWFS automatically converts your fla and swf data into LWF data.

hi,I use a LWF file to initialize multiple of the same object, then there is the problem.

@hiram hmm, interesting. It seems setBlendFunc dst = GL_ONE. Do you use add blend mode in Flash?

is it impossible to change AnchorPoint?

i wanna change lwf anchor to 0.5,0.5

@splhack didn’t add any code in flash but fscommand(“event”, “done”);

@hiram hmm, i have never experienced such issue. Are you using Cocos2d-x 3.0 beta 2? Could you try Cocos2d-x 3.0 alpha and Cocos2d-x 3.0 beta?

jamesYou wrote:

is it impossible to change AnchorPoint?

i wanna change lwf anchor to 0.5,0.5

@jamesYou LWFNode itself doesn’t have width and height, but you can adjust the position of LWF animation. For example,

lwfNode->lwf->MoveToMovie("_root", lwfNode->lwf->width / 2, lwfNode->lwf->height / 2);

or

// Fits the height of the Flash stage size to the height of specified size.  
lwfNode->lwf->FitForHeight(visibleSize.width, visibleSize.height);

// Fits the width of the Flash stage size to the width of specified size.  
lwfNode->lwf->FitForWidth(visibleSize.width, visibleSize.height);

@splhack if you convert lwf data with a texture atlas, Cocos2d-x automatically batches LWFNodes without SpriteBatchNode
What’s you mean by saying " convert lwf data with a texture atlas" ?:;qst

@jianhan513@163.com Have you read the post http://www.cocos2d-x.org/forums/18/topics/40551?r=42968#message-42968 ? LWFS can convert swf data with a texture atlas which was generated by TexturePacker.

@splhack No,I‘m using Cocos2d-x 3.0 beta. so, i need to try Cocos2d-x 3.0 alpha?

@hiram I’ve never experienced the problem, but if the problem was occurred in LWF, it might be related to LWFBitmapRenderer::Render in lwf_cocos2dx_bitmap.cpp. blendFunc.dst might be GL_ONE. Could you check it using a debugger? Cocos2d-x 3.0 beta2 might also fix the problem, i’m not sure.

I wonder if there’s a way to configure LWFS to not rename the png files that the swf uses? It renames all images to something like animation_0.png, animation_1.png, etc. The lwf it output references the images with the new file names too.

As it stands, it would be difficult to use these textures with cocos2d-x’s multiple resolutions support. Normally the game’s textures are illustrated in Photoshop/Illustrator and exported in multiple resolutions to support screens with different resolutions. With the way LWFS modifies the image filename, we have to change all images filename to match what LWFS output. What’s worse is the filename LWFS chooses for each image file may change as more images are put into the animation. This makes it very difficult to use this tool in production.

Has anyone tried this with javascript bindings?

@joni Have you tried to use “Publish for LWF” command in Flash? LWFS automatically installs it. It makes to keep the bitmap filenames.