• ! cocos2d 预编译重复


    由于预编译文件重复,导致下面的类没有被编译,所以,在写代码的时候也没有提示还报错,说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__
    
    
  • 相关阅读:
    如何提高网站在Google的排名(2)
    Key Words in my 2006
    UML: 关系
    What's SOAP
    "你试图打开的项目是Web项目,请指定URL路径"问题及解决方法
    WinXP下装SQL2000企业版
    多表联合查询的问题。。。。。
    实习技术员的基本功(十一)
    实习技术员的基本功(五)
    实习技术员的基本功(六)
  • 原文地址:https://www.cnblogs.com/yufenghou/p/5005036.html
Copyright © 2020-2023  润新知