Cocos2d-x Study Notes 04: development problem summary 01

Source: Internet
Author: User

1. The automatically adapted HD mode cannot load resources.


Reproduction method: Enable HD adaptation
 
 
  1. pDirector->enableRetinaDisplay(true); 
HD resources are provided, but SD resources are not provided. For example, xxxx-hd.png is provided, but General xxxx.png is not provided. Note that the error recurrence rate is unstable. You must delete the software on your mobile phone and clean the project to have a high probability of recurrence.
Phenomenon: loading resources on HD phones fails, and the game is stuck.
Analysis: Debugging found that fullPathFromRelativePath could not obtain the correct path, but directly returned the file name for the parameter.
Conclusion: Both HD and SD images must be provided.
2. CCMenu automatic adaptation interface disorder
Reproduction method: Use the Automatic Layout function of CCMenu to adapt to temporary resource images, and then use larger image resources.
Symptom: The positions of item buttons are superimposed on each other.
Analysis: cocos2d-x CCMenu has some very convenient automatic layout functions, such as alignItemsXXX, when the resource picture is small enough, use these functions does not matter, if the picture is large, location overlap may occur during adaptation. conclusion: if you are not in trouble, it is best to manually control the layout. 3. XCode4.2, iTouch2 4.21 system, which is fully configured by default. It can be run with hello world, 5.01 tou42. 4.21 touch2 cannot run.Reproduction Method: In XCode4.2, with the cocos2d-x template to establish helloworld, plug touch2, point run, compiled successfully, but no reaction on the phone phenomenon: the phone did not respond, there is no output in the console. On the device console, there will be something similar to the following:
 
 
  1. unknown lockdownd[16] <Error>: 2ff68000 handle_connection:             Could not receive USB message #6 from Xcode. Killing connection 
Analysis: the old version of iOS mainly refers to 5. before x, and 5. x compilation parameters are different, the main difference is armv6 and armv7, first according to this post check their settings: After the http://stackoverflow.com/questions/6378228/switching-from-xcode3-to-xcode4-cant-load-programs-onto-older-ipod-touch is confirmed correct, in the building setting in ubuntures, add the parameter armv6650) this. width = 650; "border =" 0 "alt =" "src =" http://www.bkjia.com/uploads/allimg/131228/1A9343a8-0.png "/> conclusion: it is best to add this as per project creation to prevent forgetting 4. How to disable automatic rotation of iOS screensIn gravity sensing games, automatic screen rotation is often caused, which will lead to an inversion of the screen, causing inconvenience to the operation. The method to disable gravity sensing is: "Project/ios/RootViewController. mm ", find the following function
 
 
  1. -(BOOL) shouldAutorotateToInterfaceOrientation :( UIInterfaceOrientation) interfaceOrientation {
  2. // Return UIInterfaceOrientationIsLandscape (interfaceOrientation );
  3. Return interfaceOrientation = UIInterfaceOrientationPortrait; // enter the direction parameter you want to lock
  4. // Switch to this line if you want to set portrait view
  5. // Return UIInterfaceOrientationIsPortrait (interfaceOrientation );
  6. }
650) this. width = 650; "alt =" "src ="/neweditor/editor/images/smiley/15.gif"/> thanks to friends from group 6 for providing this method, I have known a method for modifying the source code of the engine 650) this. width = 650; "alt =" "src ="/neweditor/editor/images/smiley/23.gif"/>. You do not need to change the engine source code, but only the project code.

 

This article is from the "Old G hut" blog, please be sure to keep this source http://4137613.blog.51cto.com/4127613/819677

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.