PixelBullet
0.0.1
A C++ game engine
Loading...
Searching...
No Matches
engine
include
pixelbullet
scene
components
interactable_component.h
1
#pragma once
2
3
#include "pixelbullet/serialization/node.h"
4
5
namespace
pixelbullet
6
{
7
struct
InteractableComponent
8
{
9
bool
enabled =
true
;
10
11
[[nodiscard]]
bool
operator==(
const
InteractableComponent
&)
const
noexcept
=
default
;
12
};
13
14
inline
Node
& operator<<(
Node
& node,
const
InteractableComponent
& component)
15
{
16
node[
"enabled"
] << component.enabled;
17
return
node;
18
}
19
20
inline
const
Node& operator>>(
const
Node& node, InteractableComponent& component)
21
{
22
if
(node.HasProperty(
"enabled"
))
23
{
24
node[
"enabled"
] >> component.enabled;
25
}
26
else
27
{
28
component.enabled =
true
;
29
}
30
return
node;
31
}
32
}
// namespace pixelbullet
pixelbullet::Node
Represents a hierarchical node capable of storing various data types and supporting YAML serializatio...
Definition
node.h:45
pixelbullet::InteractableComponent
Definition
interactable_component.h:8
Generated by
1.16.1