Flash2Cocos2d-x icon indicating copy to clipboard operation
Flash2Cocos2d-x copied to clipboard

Patching CCNode is a bad idea

Open farwayer opened this issue 12 years ago • 4 comments

Thx a lot for this awesome tool! But it's painful to update cocos2d-x engine to new version. And it's look very bad to patch internal engine classes. Any chance to take out additional affine transform's from CCNode class?

farwayer avatar Feb 07 '13 14:02 farwayer

I agree with you. But i didn't find a way to take out additional affine transform. If use function like setPosition(), it will be too much trouble.

2youyou2 avatar Feb 07 '13 16:02 2youyou2

At this moment I see two way to make it without patching CCNode and without use setScale(), setPosition() etc.:

  1. Subclass CCSprite (you use it for display, right?) and override nodeToParentTransform() like this:

CCAffineTransform CCMySprite::nodeToParentTransform(void) { CCAffineTransform transform = CCSprite::nodeToParentTransform(); if (m_bTransformDirty) transform = CCAffineTransformConcat(transform, m_tOtherTransform); return transform; }

and use it for display.

  1. Set shader program to CCSprite for additional affine transform

I would help, but I have no time now.

farwayer avatar Feb 08 '13 11:02 farwayer

Display can be many type, like particle, so subclass CCSprite do not satisfy requirement. Maybe set shader program to CCSprite for additional affine transform wiil be a good idea, but i am not familiar with shader.

2youyou2 avatar Feb 08 '13 11:02 2youyou2

你好,我下载了fla的demo,导入库中元件的时候提示:未在 Fla 发生 JavaScript 错误。ReferenceError: Skeleton is not defined, 库中找到符合骨架结构的元件!

oktears avatar May 17 '15 07:05 oktears