⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 entity.h.svn-base

📁 坦克大战游戏完整全套源代码
💻 SVN-BASE
字号:
#ifndef ENTITY_H
#define ENTITY_H

#include "common/utils.h"

using namespace std;

#pragma warning(disable: 4355 4250)


class Entity : public NoCopy
{
public:
    enum EntityInterfaceIds
    {
        EII_CollisionEntity,
        EII_ControlEntity,
        EII_GraphicEntity,
        EII_ViewerEntity,

        NumEntityInterfaceIds,
    };
    typedef int EntityInterfaceId;
    // allow to extend, so the type should not be EntityStatusIds
    enum EntityStatusIds
    {
        ESI_Position,
        ESI_Orientation,

        NumEntityStatusIds,
    };
    // instead, let's use int
    typedef int EntityStatusId;
    typedef int EntityTypeId;

    // basic interface of entity
    class iEntity : public NoCopy
    {
    public:
        iEntity(Entity &e) : entity(e)
        {
        }
        virtual ~iEntity()
        {
        }
        Entity &getEntity()
        {
            return entity;
        }
        const Entity &getEntity() const
        {
            return entity;
        }
    protected:
        Entity &entity;
    };

    Entity() : active(true)
    {
    }
    virtual ~Entity()
    {
    }
    virtual void step(float gameTime, float deltaTime)
    {
        gameTime, deltaTime;
    }
    virtual bool getStatus(EntityStatusId id, void *p)
    {
        id, p;
        return false;
    }
    virtual EntityTypeId getTypeId() const
    {
        return 0;
    }
    bool isActive() const
    {
        return active;
    }
    virtual iEntity* getEntityInterface(EntityInterfaceId id)
    {
        id;
        return 0;
    }
protected:
    bool active;
};

#endif

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -