回 帖 发 新 帖 刷新版面

主题:练习C++编的一个小程序

空格开始,场景是鱼缸里,代码再检查一下再帖吧

回复列表 (共18个回复)

11 楼

Class_InterFace.hpp:
class InterFace
{
    private:
        //
    protected:
        //
    public:
        bool ShouldExist;
        InterFace(){};
        virtual ~InterFace(){};
        virtual void CallEveryTime()=0;
};

12 楼

Class_GetResource.hpp:
class GetResource
{
    private:
        //
    protected:
        //
    public:
        GetResource(){};
        virtual ~GetResource();
        void GetTextures();
};
//
inline void GetResource::GetTextures()
{
    FILE *fp;
    int i=0,FileLenth;
    while((fp=fopen(TextureFileName[i],"rb"))!=NULL)
    {
        fseek(fp,0,SEEK_END);
        FileLenth=ftell(fp);
        p_TextureBuffer[i]=new char[FileLenth];
        fseek(fp,0,SEEK_SET);
        if(fread(p_TextureBuffer[i],FileLenth,1,fp)!=1)
        {
            MessageBox(NULL,"File Read Error",TextureFileName[i],MB_OK);
        }
        fclose(fp);
        i+=1;
    }
    return;
}
inline GetResource::~GetResource()
{
    for(int i=0;i<MAX_TYPE;i++)
    {
        if(p_TextureBuffer[i]!=NULL)
        {
            delete []p_TextureBuffer[i];
            p_TextureBuffer[i]=NULL;
        }
    }
    return;
}

13 楼

Class_Enviroment.hpp:
class Enviroment:public Draw
{
    private:
        //
    protected:
        //
    public:
        Enviroment(int);
        virtual ~Enviroment(){};
        void CallEveryTime();
};
inline Enviroment::Enviroment(int i_Texture)
{
    x=0;
    y=0;
    z=-1000;
    Width=100000;
    Height=75000;
    BindTexture(p_TextureBuffer[i_Texture]);
    return;
}
//
inline void Enviroment::CallEveryTime()
{
    DrawToScreen();
    return;
}

14 楼

Class_Buble.hpp:
class Buble:public Draw
{
    private:
        //
    protected:
        //
    public:
        Buble(int);
        virtual ~Buble();
        void CallEveryTime();
};
//
inline Buble::Buble(int iTexture)
{
    x=(rand()-16384)*2.5;
    y=-40000;
    z=-50;
    Width=2000+rand()%3000;
    Height=Width;
    BindTexture(p_TextureBuffer[iTexture]);
    return;
}
//
inline Buble::~Buble()
{
    return;
}
//
inline void Buble::CallEveryTime()
{
    y+=300;
    if(y>35000)
    {
        ShouldExist=false;
    }
    DrawToScreen();
    return;
}

15 楼

可能有点长,恳请各位高手不吝赐教,再帮我挑挑错

16 楼

对于强强哥的 无限钻研的精神感到钦佩
同时 对于 我在学校做一些不得不装B 的行为感到惋惜
学习

17 楼

上次看了CXXCOMP改过的程序后我受益很多,恳请大家再帮我找一找不规范的和错的地方,请大家务必帮忙.大概点一下就行,拜谢.

18 楼

这两天比较累,一直没有状态。代码我已保存,过后一定细细研读。先 顶!

我来回复

您尚未登录,请登录后再回复。点此登录或注册