ShitEngine
基于 C++20 与 SDL3 的轻量级 2D 游戏引擎
Toggle main menu visibility
载入中...
搜索中...
未找到
Prefab.h
浏览该文件的文档.
1
#pragma once
2
#include "
GameObject.h
"
3
#include <functional>
4
5
namespace
Shit
{
6
7
class
Scene
;
8
21
class
Prefab {
22
public
:
23
using
Builder
= std::function<void(
GameObject
*)>;
24
25
static
Prefab
Build
(
Builder
builder) {
26
Prefab p;
27
p.m_builder = std::move(builder);
28
return
p;
29
}
30
31
void
apply
(
GameObject
* go)
const
{
32
if
(m_builder) m_builder(go);
33
}
34
35
private
:
36
Prefab
() =
default
;
37
Builder
m_builder;
38
};
39
40
}
// namespace Shit
GameObject.h
Shit::GameObject
游戏物体类
定义
GameObject.h:22
Shit::Prefab
预制体,可重复生成相同配置的 GameObject
定义
Prefab.h:21
Shit::Prefab::Build
static Prefab Build(Builder builder)
定义
Prefab.h:25
Shit::Prefab::Builder
std::function< void(GameObject *)> Builder
定义
Prefab.h:23
Shit::Prefab::apply
void apply(GameObject *go) const
定义
Prefab.h:31
Shit::Scene
场景类
定义
Scene.h:34
Shit
定义
AudioPlayer.h:9
ShitEngine
GameObject
Prefab.h
制作者
1.17.0