Cocos2d-x porting Android Common problem handling methods

Source: Internet
Author: User

1, function, variable appears "could not be resolved" problem

This problem typically occurs when the header file for the Cocos2d-x declaration is not found, and the cocos2d header file directory is introduced in Eclipse, including the project catalog, platform/android

Adding a header file to the Hellocpp/main.cpp function

#include "AppDelegate.h" #include "cocos2d.h" #include "CCEventType.h" #include "platform/android/jni/jnihelper.h" # Include <jni.h> #include <android/log.h> #include "CCEGLView.h" #include "CCApplication.h"


2, remove the lower left corner of the screen three lines of numbers

Description of three lines of numbers:

First row render batches for the current scene

The second line takes time to render each frame

The third line is FPS

In AppDelegate.cpp file applicationdidfinishlaunching () find the following line modified to False

    Pdirector->setdisplaystats (FALSE);

3. Transplant Android, Game Adaptive Mobile screen

In the AppDelegate.cpp file applicationdidfinishlaunching () function, add the following code.

Cceglview::sharedopenglview ()->setdesignresolutionsize (1136, 640, Kresolutionshowall);//Set resolution: Wide, High, mode

4. Modify APK app name and icon

Modified Name: Eclipse Project Res->values->strings.xml File

<?xml version= "1.0" encoding= "Utf-8"?><resources> <string    name= "app_name" > Yellow man </string ></resources>

Replace icon: will prepare the different size icon, replace the Eclipse project res under drawable-* corresponding directory under the PNG image, the program will call the corresponding icon according to the phone's resolution

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.