feat: initial DX12 foundation framework
This commit is contained in:
51
Engine/Components/Entity.h
Normal file
51
Engine/Components/Entity.h
Normal file
@@ -0,0 +1,51 @@
|
||||
/**
|
||||
* @file Entity.h
|
||||
* @brief 实体组件生命周期管理接口。
|
||||
*/
|
||||
#pragma once
|
||||
#include "ComponentsCommon.h"
|
||||
#include "Transform.h"
|
||||
|
||||
|
||||
namespace XEngine {
|
||||
|
||||
/**
|
||||
* @brief 前置声明组件初始化参数结构。
|
||||
*/
|
||||
#define INIT_INFO(component) namespace component { struct init_info; }
|
||||
|
||||
INIT_INFO(transform);
|
||||
INIT_INFO(script);
|
||||
|
||||
#undef INIT_INFO
|
||||
|
||||
|
||||
namespace game_entity {
|
||||
/**
|
||||
* @brief 创建实体时可选的组件初始化信息。
|
||||
*/
|
||||
struct entity_info
|
||||
{
|
||||
transform::init_info* transform{ nullptr };
|
||||
script::init_info* script{ nullptr };
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief 创建实体并按需附加组件。
|
||||
* @param info 实体初始化信息。
|
||||
* @return 新建实体句柄。
|
||||
*/
|
||||
entity create(entity_info info);
|
||||
/**
|
||||
* @brief 删除实体及其关联组件。
|
||||
* @param id 实体标识符。
|
||||
*/
|
||||
void remove(entity_id id);
|
||||
/**
|
||||
* @brief 判断实体是否仍然存活。
|
||||
* @param id 实体标识符。
|
||||
* @return 存活返回 true,否则返回 false。
|
||||
*/
|
||||
bool is_alive(entity_id id);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user