One, the issue of version migration
1. The creation function name of the game element Sprite, Label, action, etc. is changed to create.
2. Callback for function
Callfunc_selector
Callfuncn_selector
Callfuncnd_selector
Callfunco_selector
Menu_selector
Use the new features of c++11 instead of Std::bind and std::function with:
Cc_callback_0
Cc_callback_1
Cc_callback_2
Cc_callback_3
Menuitemlabel *pauseitem =menuitemlabel::create (Label::create ("Pause","Adobe Ming Std L", +), This, Menu_selector (Mylayer::menupausecallback)); Menuitemlabel*pauseitem =menuitemlabel::create (Label::create ("Pause","Adobe Ming Std L", +), Cc_callback_1 (Mylayer::menupausecallback, This));
3. The internal class names are stripped of the prefix cc, using clone instead of copy, the Singleton class uses getinstance and Destroyinstance, and Ref is used instead of Object because COCOS2DX's official de-oc behavior
4. Template container
Using cocos2d::map<> instead of ccdictionary;
Using cocos2d::vector<> instead of Ccarray;
5.labelttf/labelbmfont/labelatlas three kinds of label classes are merged into a class label:
1 //Label2label* Label1 = Label::createwithsystemfont ("1","Youyuan", -);3label* Label2 = Label::createwithttf ("1","Youyuan", -);4label* Label3 = Label::createwithbmfont ("font/font.fnt","0123456789");
6. The processing of messages is changed to trigger mode:
1 // Keyboard Messages Available 2 Auto Listenerkey = eventlistenerkeyboard::create (); 3 This ); 4 This ); 5 this);
7. Replace all APIs marked as obsolete with the new API, eliminating warnings during project compilation.
Second, porting to Android platform
This looks like when you first ported to the Android platform:
The reason is that the Android phone resolution is too large, modify the appdelegate::applicationdidfinishlaunching () function can:
1 StaticCocos2d::size largesize = Cocos2d::size ( the,1920x1080);2 StaticCocos2d::size designresolutionsize = Cocos2d::size (540,960);3 4 BOOLappdelegate::applicationdidfinishlaunching () {5 //Initialize Director6Auto Director =director::getinstance ();7Auto Glview = director->Getopenglview ();8 if(!Glview) {9Glview = Glview::create ("Planegame");Ten //Mi3 Phone Resolution: 1920x1080 OneGlview->setframesize (largesize.width,largesize.height); ADirector->Setopenglview (glview); -Glview->setdesignresolutionsize (540,960, Resolutionpolicy::no_border); - } the -Director->setcontentscalefactor (0.5f); - - //turn on display FPS +Director->setdisplaystats (true); - + //set FPS. The default value is 1.0/60 if you don ' t call this ADirector->setanimationinterval (1.0/ -); at - //create a scene. It s an Autorelease object -Auto scene =Planewarmenu::scene (); - - //Run -Director->runwithscene (scene); in - return true; to}
After the change, the game will be better suited to the Android screen.
cocos2d-x-1.0.1-based aircraft battle game migrated to cocos2d-x-3.0 version and ported to Android platform for successful operation