For cocos2d-x v3.0.
should we use shared_ptr or manual retain / release ?
So, my first was to use shared_ptr, but then I realized that that would imply changing the whole API, so I though that using manual retain/release would be OK (like in v2.1), so I proposed to keep using manual retain/release.
If we are going to use manual retain/release, should we still use autorelease, or not ?
Let’s see:
A)
// manual retain/release with autorelease
auto action = Sequence::create(
MoveBy::create( 2, ccp(240,0)),
RotateBy::create( 2, 540),
ScaleTo::create(1,0.1f),
RemoveSelf::create(),
NULL);
B)
// same example with shared_ptr
auto action = Sequence::create(
MoveBy::create( 2, ccp(240,0)),
RotateBy::create( 2, 540),
ScaleTo::create(1,0.1f),
RemoveSelf::create(),
NULL);
C)
// same example with manual retain/release, but WITHOUT autorelease
// too long
auto a1 = MoveBy::create( 2, ccp(240,0)),
auto a2 = RotateBy::create( 2, 540),
auto a3 = ScaleTo::create(1,0.1f),
auto a4 = RemoveSelf::create(),
auto action = Sequence::create(a1, a2, a3, a4, NULL);
a1->release();
a2->release();
a3->release();
a4->release();
And I don’t like the code for retain/release without autorelease.
I would go with A) or B).
What are your thoughts ?