std::function

CallFuncND and CallFuncO were
removed since it can be created with simulated with CallFuncN and CallFunc.
See ActionsTest.cpp for more examples

MenuItem supports std::function<void(Node*)> as
callbacks

CallFunc example:

// in v2.1CCCallFunc*action1=CCCallFunc::create(this,callfunc_selector(MyClass::callback_0));// in v3.0 (short version)autoaction1=CallFunc::create(CC_CALLBACK_0(MyClass::callback_0,this));autoaction2=CallFunc::create(CC_CALLBACK_0(MyClass::callback_1,this,additional_parameters));// in v3.0 (long version)autoaction1=CallFunc::create(std::bind(&MyClass::callback_0,this));autoaction2=CallFunc::create(std::bind(&MyClass::callback_1,this,additional_parameters));// in v3.0 you can also use lambdas or any other "Function" objectautoaction1=CallFunc::create([&](){autos=Director::sharedDirector()->getWinSize();autolabel=LabelTTF::create("called:lambda callback","Marker Felt",16);label->setPosition(ccp(s.width/4*1,s.height/2-40));this->addChild(label);});

MenuItem example:

// in v2.1CCMenuItemLabel*item=CCMenuItemLabel::create(label,this,menu_selector(MyClass::callback));// in v3.0 (short version)autoitem=MenuItemLabel::create(label,CC_CALLBACK_1(MyClass::callback,this));// in v3.0 (long version)autoitem=MenuItemLabel::create(label,std::bind(&MyClass::callback,this,std::placeholders::_1));// in v3.0 you can use lambdas or any other "Function" objectautoitem=MenuItemLabel::create(label,[&](Object*sender){// do something. Item "sender" clicked});

strongly
typed enums

Feature added in v3.0-pre-alpha0

Constants and enums that started with k,
and that usually were defined as int or
as simple enum where replaced with strongly
typed enums ( enum class ) to prevent collisions
and type errors. The new format is:

Adding
Touch Event Listener

For TouchOneByOne:

autosprite=Sprite::create("file.png");...autolistener=EventListenerTouchOneByOne::create();listener->setSwallowTouch(true);listener->onTouchBegan=[](Touch*touch,Event*event){do_some_thing();returntrue;};listener->onTouchMoved=[](Touch*touch,Event*event){do_some_thing();};listener->onTouchEnded=[](Touch*touch,Event*event){do_some_thing();};listener->onTouchCancelled=[](Touch*touch,Event*event){do_some_thing();};// The priority of the touch listener is based on the draw order of spriteEventDispatcher::getInstance()->addEventListenerWithSceneGraphPriority(listener,sprite);// Or the priority of the touch listener is a fixed valueEventDispatcher::getInstance()->addEventListenerWithFixedPriority(listener,100);// 100 is a fixed value

For TouchAllAtOnce

autosprite=Sprite::create("file.png");...autolistener=EventListenerTouchAllAtOnce::create();listener->onTouchesBegan=[](conststd::vector<Touch*>&touches,Event*event){do_some_thing();};listener->onTouchesMoved=[](conststd::vector<Touch*>&touches,Event*event){do_some_thing();};listener->onTouchesEnded=[](conststd::vector<Touch*>&touches,Event*event){do_some_thing();};listener->onTouchesCancelled=[](conststd::vector<Touch*>&touches,Event*event){do_some_thing();};// The priority of the touch listener is based on the draw order of spriteEventDispatcher::getInstance()->addEventListenerWithSceneGraphPriority(listener,sprite);// Or the priority of the touch listener is a fixed valueEventDispatcher::getInstance()->addEventListenerWithFixedPriority(listener,100);// 100 is a fixed value

PhysicsBody

A PhysicsBody object is used to add physics
simulation to a node. If you create a PhysicsBody and
set it to a node, and add the node the a scene which create with physics, it will perform the physics simulation when update.

PhysicsShape

A PhysicsShape object is a shape that make
the body can have collisions. you can add one or more PhysicsShape to
aPhysicsBody. Shape classes: PhysicsShapeCircle, PhysicsShapeBox, PhysicsShapePolygon, PhysicsShapeEdgeSegment,PhysicsShapeEdgeBox, PhysicsShapeEdgePolygon, PhysicsShapeEdgeChain.

PhysicsJoint

A PhysicsJoint object connects two physics
bodies together so that they are simulated together by the physics world. Joint classes: PhysicsJointFixed, PhysicsJointLimit, PhysicsJointPin, PhysicsJointDistance, PhysicsJointSpring,PhysicsJointGroove, PhysicsJointRotarySpring, PhysicsJointRotaryLimit, PhysicsJointRatchet, PhysicsJointGear,PhysicsJointMotor.

PhysicsContact

A PhysicsContact object is created automatically
to describes a contact between two physical bodies in a PhysicsWorld.
you can control the contact behavior from the physics contact event listener. Other classes contain the contact information:PhysicsContactPreSolve, PhysicsContactPostSolve.
The event listener for physics: EventListenerPhysicsContact,EventListenerPhysicsContactWithBodies, EventListenerPhysicsContactWithShapes, EventListenerPhysicsContactWithGroup.

// in v2.1ccColor3Bcolor3B=ccc3(0,0,0);ccc3BEqual(color3B,ccc3(1,1,1));ccColor4Bcolor4B=ccc4(0,0,0,0);ccColor4Fcolor4F=ccc4f(0,0,0,0);color4F=ccc4FFromccc3B(color3B);color4F=ccc4FFromccc4B(color4B);ccc4FEqual(color4F,ccc4F(1,1,1,1));color4B=ccc4BFromccc4F(color4F);color3B=ccWHITE;// in v3.0Color3Bcolor3B=Color3B(0,0,0);color3B.equals(Color3B(1,1,1));Color4Bcolor4B=Color4B(0,0,0,0);Color4Fcolor4F=Color4F(0,0,0,0);color4F=Color4F(color3B);color4F=Color4F(color4B);color4F.equals(Color4F(1,1,1,1));color4B=Color4B(color4F);color3B=Color3B::WHITE;

Changes
in the Lua bindings

Use
bindings-generator tool for Lua binding

Only configurating the *.ini files in the tools/tolua folder,not to write a lot of *.pkg files

Use
ScriptHandlerMgr to manage the register and unregister of Lua function

When we want to add register and unregister functions of Lua function for class, we need to change the declarative and defined files and then bind to Lua. In v3.0, we use the ScriptHandlerMgr.
As an example, lets see the MenuItem class:
In the 2.x version, we needed to add a declaration in the MenuItem header file: