|
ShitEngine
基于 C++20 与 SDL3 的轻量级 2D 游戏引擎
|
预制体,可重复生成相同配置的 GameObject 更多...
#include <Prefab.h>
Public 类型 | |
| using | Builder = std::function<void(GameObject*)> |
Public 成员函数 | |
| void | apply (GameObject *go) const |
静态 Public 成员函数 | |
| static Prefab | Build (Builder builder) |
预制体,可重复生成相同配置的 GameObject
用法: auto enemyPrefab = Shit::Prefab::Build([](Shit::GameObject* go) { go->addComponent<Shit::TransformComponent>(); go->addComponent<Shit::SpriteRenderer>()->setTexturePath("enemy.png"); });
// 在场景中实例化 auto* enemy = scene->instantiate(enemyPrefab);
| using Builder = std::function<void(GameObject*)> |
|
inline |
|
inlinestatic |