sandbox
Loading...
Searching...
No Matches
node.hpp
1// SPDX-License-Identifier: MIT
2#ifndef LIBSBX_SCENES_NODE_HPP_
3#define LIBSBX_SCENES_NODE_HPP_
4
5#include <unordered_set>
6
7#include <libsbx/ecs/registry.hpp>
8#include <libsbx/ecs/entity.hpp>
9
10// #include <libsbx/signals/signal.hpp>
11
12// #include <libsbx/memory/observer_ptr.hpp>
13
14namespace sbx::scenes {
15
16// class node {
17
18// friend class scene;
19
20// public:
21
22// static const node null;
23
24// ~node() = default;
25
26// template<typename Component, typename... Args>
27// auto add_component(Args&&... args) -> Component& {
28// return _registry->emplace<Component>(_entity, std::forward<Args>(args)...);
29// }
30
31// template<typename Component, typename... Args>
32// auto get_or_add_component(Args&&... args) -> Component& {
33// return _registry->get_or_emplace<Component>(_entity, std::forward<Args>(args)...);
34// }
35
36// template<typename Component>
37// auto get_component() -> Component& {
38// return _registry->get<Component>(_entity);
39// }
40
41// template<typename Component>
42// auto get_component() const -> const Component& {
43// return _registry->get<Component>(_entity);
44// }
45
46// template<typename Component>
47// auto has_component() const -> bool {
48// return _registry->try_get<Component>(_entity) != nullptr;
49// }
50
51// template<typename Component>
52// auto remove_component() -> void {
53// _registry->remove<Component>(_entity);
54// }
55
56// auto is_valid() const -> bool {
57// return _registry->is_valid(_entity);
58// }
59
60// operator bool() const noexcept {
61// return *this != null;
62// }
63
64// friend auto operator==(const node& lhs, const node& rhs) -> bool {
65// return lhs._registry == rhs._registry && lhs._entity == rhs._entity;
66// }
67
68// private:
69
70// node(memory::observer_ptr<ecs::registry> registry, ecs::entity entity)
71// : _registry{registry},
72// _entity{entity} { }
73
74// memory::observer_ptr<ecs::registry> _registry;
75// ecs::entity _entity;
76
77// }; // class node
78
79// class node {
80
81// friend struct sbx::ecs::entity_traits<node>;
82
83// public:
84
85// inline static constexpr auto null = sbx::ecs::null_entity;
86
87// using entity_type = std::uint32_t;
88
89// constexpr operator entity_type() const noexcept {
90// return _value;
91// }
92
93// constexpr operator bool() const noexcept {
94// return _value != null;
95// }
96
97// private:
98
99// explicit constexpr node(const entity_type value) noexcept
100// : _value{value} { }
101
102// entity_type _value;
103
104// }; // struct node
105
106enum class node : std::uint32_t {
107 null = ecs::null_entity
108}; // enum class node
109
110} // namespace sbx::scenes
111
112#endif // LIBSBX_SCENES_NODE_HPP_
Definition: tests.cpp:6