[Game Development Remarks] About how to generate an image white block when running cocos2dx_v1.x for iPhone and Android, add gamecenter, and compile Android flash back & cclog and C

Source: Internet
Author: User

The articles on this site are originally written by Li huaming himi. The reprinted documents must be clearly indicated:
Reproduced from [Black Rice gamedev block] original link: http://www.himigame.com/game-detail/1035.html

☞Click to subscribe☜The latest developments in this blog! Notify you of the latest blog in time!


Note the following problems that may occur to children's shoes:

1. About cocos2dx v1.x running on the iPhone and Android platforms, the image becomes white and the size is the same. Picture white issues.

The reasons for this problem are as follows:

1.1 The problem is caused by the strong conversion between ccsprite and ccnode;

1.2 PVR. CCZ resource size width and height are not square (N power of 2)

Solution. The himi method is provided before. For this problem, see the previous blog post:

[IOS-cocos2d-X game development 11] New ccsprite () errors & use ccuserdefault and PVR. CCZ in cocos2dx should pay attention!

Another reason for this problem is explained today:

Cause engine particle system, when using the particle system, the console gives a warning:

OpenGL error 0 ×0500 in-[eaglview swapbuffers]

This problem may result in the packaging of the image in the white block, the actual model: Android platform M9, IOS: iPhone 4.3.3

The post about this error is linked below: http://www.cocos2d-x.org/boards/6/topics/7557? R = 19039 # message-19039

2. the following error occurs when himi runs in cocos2dx 1.x and calls the gamecenter function in ios6:

(Note: not only gamecenter is used, but other problems in ios6 will also be encountered)

Terminating app due to uncaught exception 'UIApplicationInvalidInterfaceOrientation', reason: 'Supported orientations has no common orientation with the application, and shouldAutorotate is returning YES'

The solution is as follows:

Add the following three functions to the View Controller class that uses gamecenter:

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation{return (interfaceOrientation == UIInterfaceOrientationLandscapeLeft || interfaceOrientation == UIInterfaceOrientationLandscapeRight );}-(NSUInteger)supportedInterfaceOrientations{return UIInterfaceOrientationMaskLandscape;}- (BOOL)shouldAutorotate{return YES;}

Generally, cocos2dx is written in appcontroller. h/mm under the IOS folder of the cocos2dx project by default when components at the iOS platform level are used. Of course, you can also define the MM hybrid editing class by yourself.

 

3. The third problem is the cause of Android crash caused by cocos2dx 1.x compilation.

There are many types of problems (but there is basically no problem if you write code specifications). Here, himi will give you a problem that has been verified.

In the cocos2dx project, the xcode code of himi has the following two classes. The Inheritance relationships are as follows:

Hclassa: Public ccsprte

Hclassb: Public hclassa

If you forcibly transfer the hclassa type to the hclassb object, Android will crash !!!!

Although this type of parent class strong rotor class can work in Java, there is no problem in running IOS,! When compiled to Android, 100% crash occurs.

 

For debugging and printing cclog and cclog after ndk is compiled to Android, let's briefly describe:

Many children's shoes asked me why cclog is not printed on Android. Keke and children's shoes can click to enter the definition of cclog, which is automatically canceled after being compiled and not included in the Code, the cclog is not, so we want to print and observe it on Android. Use cclog.

 

 

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.