Cocos2d-x 3.0 Game Example Learning notes "parkour" transplanted to Android phone

Source: Internet
Author: User

Description: Here is the reference: Xiaofeng Moon predecessors of the blog, he is going to run Cool network tutorial, with cocos2d-x 2.X version rewrite, currently I am learning cocos2d-x3.0 so with Cocos2d-x 3.0 rewrite, and do related notes

Well, since the last "parkour" after the end of what did not do something, mainly fixed a little bug, also in the corresponding article made corresponding changes. However, only in the window to watch the play and what is too much meaning!!! And then try to get the phone to try--ok, the newborn calf do not face, oh no! Not afraid of spraying. Here's a record of my transplant process. ( This will use a new size resource.) will be all packaged later ) ...

Here are a few things to talk about:

1, a little trouble

2, simple and rough way to transplant

3, the transplant needs to prepare-----is how to transplant success

First look at my phone:


So take a look at our current question: ... We originally run on the Win32 of those resources, not through the screen to adapt to the relevant knowledge, put on the mobile phone is definitely not appropriate, just 640*320, now many mobile phones are almost 4.0 inches above the screen, resolution is also a lot of 1200 (about) *800 (about). But for the lack of knowledge about screen adaptation, I had to find a shortcut to see the original download from the predecessors of the project, there is a resource for the ipad, to see the size of those pictures .... haha haha, incredibly size is not too poor to go there ... As a matter of course, the simple and rude Way comes: 1, download new resources to replace the original resources: This includes: new resources, new code (also for porting modified some size), the generated apk Http://pan.baidu.com/s/1gd5TzPLDo not know is not today Baidu cloud a bit of a problem ... Upload several times have failed, if someone can't, can stay here mailbox, I send seeds, oh no. Send you 2, we need to do is to modify some of the basic size to adapt to your phone 3, the third is nothing to say, anyway, in the code, and the previous code difference is not much. The main is to spit groove, pro ... Can you imagine how much trouble this is? This simple rough way is to change the size of a place, I will recompile Android once, then connect the phone, install APK, test, find problems, modify size, compile Android-----loop n times .... The little buddy who compiled Android should know that compiling is how slow, multi-card .... Well, here's how we can transplant success: first of all, we use the button, that is, to use the libExtensions.lib, here should be called to join the third-party library it!! So big on the things we do not understand, simple to do with me: 1. Open the "project directory" \proj.android\jni inside the android.mk ... Modify to: The red part is the code that needs to be added
Local_path: = $ (call My-dir) include $ (clear_vars) Local_module: = Cocos2dcpp_sharedlocal_module_filename: = Libcocos2dcpplocal_src_files: = hellocpp/main.cpp \<span style= "color: #ff0000;" >.. /.. /classes/appdelegate.cpp. /.. /classes/base.cpp. /.. /classes/basemanager.cpp. /.. /classes/coin.cpp. /.. /classes/gameover.cpp. /.. /classes/mainscene.cpp. /.. /classes/playscene.cpp. /.. /classes/rock.cpp. /.. /classes/runner.cpp</span>local_c_includes: = $ (Local_path)/. /.. /classes\<span style= "color: #ff0000;" > $ (local_path)/. /.. /cocos2d/cocos/2d/. /.. /extensions \</span>local_whole_static_libraries: = cocos2dx_staticlocal_whole_static_libraries + = Cocosdenshion_staticlocal_whole_static_libraries + = Box2d_static<span style= "color: #ff0000;" >local_whole_static_libraries + = COCOS_EXTENSION_STATIC&LT;/span>include $ (build_shared_library) $ (call import-module,2d) $ (call Import-module,audio/android) $ (call import-module,box2d) <span style= "color: #ff0000;" >$ (call import-module,extensions) </span>
Note that the corresponding code is added here, do not get a few more lines or something. I'm not familiar with this stuff, but it seems like there's been a mistake in the compilation because of some more line breaks.2, then cmd to the project directory, enter Cocos compile-p android-j
OK .... It's so simple ..... Then, you can wash and sleep ... This thing compiles more than 10, 20 minutes .It then appears similar to the following: (Here I stayed before) mainly to see:BUILD SuccessfulWell, congratulations, you've compiled it successfully.
then you can go to the project directory under \proj.android\bin to see there is a run-debug.apk ... You can copy it to your phone ....
OK, here is the main thing to say is that the general game is not used in other third-party libraries or anything else ... You do not need to modify the android.mk. Like here, we use the extension library in the game, (is not the third-party library I do not know) ... Then you need to modify android.mk add something. Most of these things are online ....
all right. It's over here again.Personal ignorance point of view, welcome to correct and discuss!

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.