您的位置:首页 > 移动开发 > Cocos引擎

! cocos2d 预编译重复

2015-11-29 17:17 417 查看
由于预编译文件重复,导致下面的类没有被编译,所以,在写代码的时候也没有提示还报错,说LoadingScene没有定义。

#ifndef __HELLOWORLD_SCENE_H__
#define __HELLOWORLD_SCENE_H__

#include "cocos2d.h"

class HelloWorld : public cocos2d::Layer
{
public:
static cocos2d::Scene* createScene();

virtual bool init();

// a selector callback
void menuCloseCallback(cocos2d::Ref* pSender);

// implement the "static create()" method manually
CREATE_FUNC(HelloWorld);
};

#endif // __HELLOWORLD_SCENE_H__

#ifndef __HELLOWORLD_SCENE_H__
#define __HELLOWORLD_SCENE_H__

#include "cocos2d.h"

class LoadingScene : public cocos2d::Layer
{
public:
// there's no 'id' in cpp, so we recommend returning the class instance pointer
static cocos2d::Scene* createScene();

// Here's a difference. Method 'init' in cocos2d-x returns bool, instead of returning 'id' in cocos2d-iphone
virtual bool init();

// implement the "static create()" method manually
CREATE_FUNC(LoadingScene);
virtual void onEnter() override;
virtual void onExit() override;

private:
float progressPercent = 0.0f;
float everyAdd = 5.0f;
cocos2d::ProgressTimer *loadProgress = nullptr;
cocos2d::LabelTTF* loadLabel;
cocos2d::LabelTTF* percentLabel;
void preloadResource();
void progessAdd();
void loadingCallback (cocos2d::Texture2D*);
};

#endif // __LoadingScene_SCENE_H__
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: