zoukankan      html  css  js  c++  java
  • ! 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__
    
    
  • 相关阅读:
    .NET Core 初次上手Swagger
    SQL server字符串分割成表-表分割为字符串
    C# DataTable、DataSet、List、相互转换
    .NET core Quartz 定时任务框架 demo
    SQL 乐色干货笔记
    .NET-异步操作
    .NET Core随笔把数据库数据查出来转JSON并输出
    ASP.NET Nlog上手练习小例子
    C# 数据类型
    获取Excel
  • 原文地址:https://www.cnblogs.com/yufenghou/p/5005036.html
Copyright © 2011-2022 走看看