cocos2dx项目中新增场景类
从0开始创建一个cocos2dx项目然后运行是可以的,但是如果我们要自己来创建属于自己的场景类呢? 理论永远只是停留在理论,实践过后才知道问题并不是那么简单: 初步尝试: 1.在项目工程中的classes文件夹中右击-添加-新建项--,然后开始写类代码; 2.在逻辑类
从0开始创建一个cocos2dx项目然后运行是可以的,但是如果我们要自己来创建属于自己的场景类呢?理论永远只是停留在理论,实践过后才知道问题并不是那么简单:
初步尝试:
1.在项目工程中的classes文件夹中右击-添加-新建项--,然后开始写类代码;
2.在逻辑类中引用的时候就出问题了,就是#include"LoadingLayer.h",会提示找不到?
3.经过跟网络高手聊过之后才知道,默认创建的类路径实在sln默认路径下,而vs的项目却不能简单的include;
解决方法:
A.类路径有问题,可以手动设置下include path;
B.把新添加的默认sln目录下的源码文件手动拷贝到相应项目的Classes下(include默认引用目录);
last,.将vs工程中的新添加代码文件删掉,再重新add进来,恢复正常。
进入图解模式:
1.导入时出错提示
2.查看新增文件的路径(在cocos的默认路径--sln路径--非CLasses路径)
3.手动将新增源码文件copy到相应项目工程的Classes路径
4.工程中先把源文件删掉,再右击Classes-add-现有项-找到Classes路径--添加新增文件
5.回头查看引用新增文件的地方,路径有效,无错误提示
cocos2dx正式开搞了呵、
编译过程问题复现:
1.win32可以正常编译显示,交叉编译不行:
提示 error: undefined reference to 'LoadingLayer::scenc e()'
意思就是说交叉编译的时候没有引用到这个类;
那么我们要进入到android工程中的Android.mk文件看下究竟:在LOCAL_SRC_FILES后面添加一行
../../Classes/LoadingLayer.cpp 记得在上一行后面加上反斜杠---->" \"
再次进入到cygwin中,找到相应Android目录,赋予权限,然后再./build_native.sh;
http://stackoverflow.com/questions/12125248/trying-to-switch-scenes-in-cocos2d-x-undefined-reference-to-diffmenuscene
2.当一切就绪,.so已经生成的前提下,在eclipse控制台中编译会出现如下错误提示:
Unable to add 'D:\series_cocos2d-x\cocos2d-x-2.2.1\cocos2d-x-2.2.1\projects\LoveHong\proj.android\assets\CloseNormal.png': Zip add failed
ERROR: unable to process assets while packaging 'D:\series_cocos2d-x\cocos2d-x-2.2.1\cocos2d-x-2.2.1\projects\LoveHong\proj.android\bin\resources.ap_'
[2014-04-23 13:04:12 - LoveHong] ERROR: packaging of 'D:\series_cocos2d-x\cocos2d-x-2.2.1\cocos2d-x-2.2.1\projects\LoveHong\proj.android\bin\resources.ap_' failed
如果出现上述错误,这样解决:
在cygwin窗口中,cd assets ; chmod -R 777 * 【备用招数cd ..; ./build_native.sh】
刷新eclipse中要编译的工程;【如果出现问题,以上步骤多试几次】
3.跑在真机上没啥问题,在模拟器中会有如下错误提示:
.......: No configs match configSpec
...
Emulator without GPU emulation detected.
说明开启的模拟器没有开启GPU支持----打开模拟器管理界面--选中自己要启动的模拟器--edit--choose Use Host GPU
如果你是用genymotion来作为模拟器,需要安装一个插件Genymotion-ARM-Translation;(自行检索)
因为geny是x86架构,非ARM架构,所以跑起来飞快;那么要安装一个能够转换成ARM架构的插件才可以完美运行;

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

Yesterday during the interview, I was asked whether I had done any long-tail related questions, so I thought I would give a brief summary. The long-tail problem of autonomous driving refers to edge cases in autonomous vehicles, that is, possible scenarios with a low probability of occurrence. The perceived long-tail problem is one of the main reasons currently limiting the operational design domain of single-vehicle intelligent autonomous vehicles. The underlying architecture and most technical issues of autonomous driving have been solved, and the remaining 5% of long-tail problems have gradually become the key to restricting the development of autonomous driving. These problems include a variety of fragmented scenarios, extreme situations, and unpredictable human behavior. The "long tail" of edge scenarios in autonomous driving refers to edge cases in autonomous vehicles (AVs). Edge cases are possible scenarios with a low probability of occurrence. these rare events

How to Personalize Calls on iPhone Apple’s iOS 17 introduces a new feature called Contact Posters that allows you to personalize the look of your call screen on your iPhone. This feature allows you to design a poster using selected photos, colors, fonts, and Memoji as contact cards. So when you make a call, your custom image will appear on the recipient's iPhone exactly as you envisioned. You can choose to share your unique contact poster with all your saved contacts, or choose who can see it. Likewise, during a call exchange, you will also see other people's contact posters. Additionally, Apple lets you set specific contact photos for individual contacts, making calls from those contacts

Title: Realme Phone Beginner’s Guide: How to Create Folders on Realme Phone? In today's society, mobile phones have become an indispensable tool in people's lives. As a popular smartphone brand, Realme Phone is loved by users for its simple and practical operating system. In the process of using Realme phones, many people may encounter situations where they need to organize files and applications on their phones, and creating folders is an effective way. This article will introduce how to create folders on Realme phones to help users better manage their phone content. No.

This article will interest you if you are interested in using GIMP for pixel art creation on Windows. GIMP is a well-known graphics editing software that is not only free and open source, but also helps users create beautiful images and designs easily. In addition to being suitable for beginners and professional designers alike, GIMP can also be used to create pixel art, a form of digital art that utilizes pixels as the only building blocks for drawing and creating. How to Create Pixel Art in GIMP Here are the main steps to create pixel pictures using GIMP on a Windows PC: Download and install GIMP, then launch the application. Create a new image. Resize width and height. Select the pencil tool. Set the brush type to pixels. set up

Many friends expressed that they want to know how to create a family in Gree+ software. Here is the operation method for you. Friends who want to know more, come and take a look with me. First, open the Gree+ software on your mobile phone and log in. Then, in the options bar at the bottom of the page, click the "My" option on the far right to enter the personal account page. 2. After coming to my page, there is a "Create Family" option under "Family". After finding it, click on it to enter. 3. Next jump to the page to create a family, enter the family name to be set in the input box according to the prompts, and click the "Save" button in the upper right corner after entering it. 4. Finally, a "save successfully" prompt will pop up at the bottom of the page, indicating that the family has been successfully created.

How to use Highcharts to create a Gantt chart requires specific code examples. Introduction: The Gantt chart is a chart form commonly used to display project progress and time management. It can visually display the start time, end time and progress of the task. Highcharts is a powerful JavaScript chart library that provides rich chart types and flexible configuration options. This article will introduce how to use Highcharts to create a Gantt chart and give specific code examples. 1. Highchart

In iOS17, Apple has added a contact poster feature to its commonly used Phone and Contacts apps. This feature allows users to set personalized posters for each contact, making the address book more visual and personal. Contact posters can help users identify and locate specific contacts more quickly, improving user experience. Through this feature, users can add specific pictures or logos to each contact according to their preferences and needs, making the address book interface more vivid. Apple in iOS17 provides iPhone users with a novel way to express themselves, and added a personalizable contact poster. The Contact Poster feature allows you to display unique, personalized content when calling other iPhone users. you

Start the journey of Django project: start from the command line and create your first Django project. Django is a powerful and flexible web application framework. It is based on Python and provides many tools and functions needed to develop web applications. This article will lead you to create your first Django project starting from the command line. Before starting, make sure you have Python and Django installed. Step 1: Create the project directory First, open the command line window and create a new directory
