Files
DX12/Engine/Components/Entity.h
2026-03-19 18:27:49 +08:00

52 lines
1001 B
C++
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
/**
* @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);
}
}