Files
XCEngine/docs/api/components/components.md
ssdfasd 750ac95951 docs: update README.md and fix components module docs
- Update README.md project structure docs/api section
  - Add missing audio/, components/, scene/ directories
  - Reorder alphabetically
- Update Components test count from 2+ to 3
- Expand documentation section with module listings
- Remove incomplete audio-source and audio-listener component docs
  from components.md (referenced 30+ and 16+ non-existent method docs)
2026-03-22 13:28:14 +08:00

1.5 KiB
Raw Blame History

Components 模块概览

命名空间: XCEngine::Components

类型: module

描述: XCEngine 的 ECS实体组件系统组件模块。

概述

Components 模块是 XCEngine ECS 架构中的组件层提供各种游戏对象组件。这些组件附加到实体Entity定义了游戏对象的行为和数据。组件系统支持 Transform、Audio、Render 等功能。

模块内容

核心组件

组件 文件 描述
Component Component.h 组件基类,所有组件的父类
GameObject GameObject.h 游戏对象实体

变换组件

组件 文件 描述
TransformComponent TransformComponent.h 变换组件,包含位置、旋转、缩放

使用示例

#include <XCEngine/Components/GameObject.h>
#include <XCEngine/Components/TransformComponent.h>
#include <XCEngine/Components/AudioSourceComponent.h>

using namespace XCEngine::Components;

void CreateAudioEntity() {
    GameObject* entity = new GameObject("AudioEntity");
    
    auto transform = entity->AddComponent<TransformComponent>();
    transform->SetPosition(Vector3(0, 0, 0));
    
    auto audioSource = entity->AddComponent<AudioSourceComponent>();
    audioSource->SetVolume(0.8f);
}

相关文档