Skip to content

Commit 130d88f

Browse files
committed
Merge branch 'chore/cleanup-line-endings' into chore/use-ecsact-cli
2 parents b344314 + 07ea3f9 commit 130d88f

16 files changed

+1987
-1987
lines changed

ecsact/entt/entity.hh

Lines changed: 63 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -1,63 +1,63 @@
1-
#pragma once
2-
3-
#include <cstdint>
4-
#include "ecsact/runtime/common.h"
5-
#include <entt/entity/entity.hpp>
6-
7-
namespace ecsact::entt {
8-
9-
/**
10-
* The Ecsact and EnTT entity IDs are supposed to be 1:1. This class serves to
11-
* make using either trivial.
12-
*/
13-
class entity_id {
14-
std::int32_t _id;
15-
16-
public:
17-
inline entity_id() {
18-
}
19-
20-
inline entity_id(::entt::entity entt_entity)
21-
: _id(reinterpret_cast<std::int32_t&>(entt_entity)) {
22-
}
23-
24-
inline entity_id(ecsact_entity_id ecsact_entity)
25-
: _id(reinterpret_cast<std::int32_t&>(ecsact_entity)) {
26-
}
27-
28-
entity_id(const entity_id&) = default;
29-
entity_id(entity_id&&) = default;
30-
31-
auto operator=(const entity_id&) -> entity_id& = default;
32-
auto operator=(entity_id&&) -> entity_id& = default;
33-
34-
auto operator<=>(const entity_id&) const = default;
35-
36-
inline auto operator=(::entt::entity entt_entity) noexcept -> entity_id& {
37-
_id = reinterpret_cast<std::int32_t&>(entt_entity);
38-
return *this;
39-
}
40-
41-
inline auto operator=(ecsact_entity_id ecsact_entity) noexcept -> entity_id& {
42-
_id = reinterpret_cast<std::int32_t&>(ecsact_entity);
43-
return *this;
44-
}
45-
46-
inline operator ecsact_entity_id() const noexcept {
47-
return reinterpret_cast<const ecsact_entity_id&>(_id);
48-
}
49-
50-
inline operator ::entt::entity() const noexcept {
51-
return reinterpret_cast<const ::entt::entity&>(_id);
52-
}
53-
54-
[[nodiscard]] inline auto as_ecsact() const noexcept -> ecsact_entity_id {
55-
return reinterpret_cast<const ecsact_entity_id&>(_id);
56-
}
57-
58-
[[nodiscard]] inline auto as_entt() const noexcept -> ::entt::entity {
59-
return reinterpret_cast<const ::entt::entity&>(_id);
60-
}
61-
};
62-
63-
} // namespace ecsact::entt
1+
#pragma once
2+
3+
#include <cstdint>
4+
#include "ecsact/runtime/common.h"
5+
#include <entt/entity/entity.hpp>
6+
7+
namespace ecsact::entt {
8+
9+
/**
10+
* The Ecsact and EnTT entity IDs are supposed to be 1:1. This class serves to
11+
* make using either trivial.
12+
*/
13+
class entity_id {
14+
std::int32_t _id;
15+
16+
public:
17+
inline entity_id() {
18+
}
19+
20+
inline entity_id(::entt::entity entt_entity)
21+
: _id(reinterpret_cast<std::int32_t&>(entt_entity)) {
22+
}
23+
24+
inline entity_id(ecsact_entity_id ecsact_entity)
25+
: _id(reinterpret_cast<std::int32_t&>(ecsact_entity)) {
26+
}
27+
28+
entity_id(const entity_id&) = default;
29+
entity_id(entity_id&&) = default;
30+
31+
auto operator=(const entity_id&) -> entity_id& = default;
32+
auto operator=(entity_id&&) -> entity_id& = default;
33+
34+
auto operator<=>(const entity_id&) const = default;
35+
36+
inline auto operator=(::entt::entity entt_entity) noexcept -> entity_id& {
37+
_id = reinterpret_cast<std::int32_t&>(entt_entity);
38+
return *this;
39+
}
40+
41+
inline auto operator=(ecsact_entity_id ecsact_entity) noexcept -> entity_id& {
42+
_id = reinterpret_cast<std::int32_t&>(ecsact_entity);
43+
return *this;
44+
}
45+
46+
inline operator ecsact_entity_id() const noexcept {
47+
return reinterpret_cast<const ecsact_entity_id&>(_id);
48+
}
49+
50+
inline operator ::entt::entity() const noexcept {
51+
return reinterpret_cast<const ::entt::entity&>(_id);
52+
}
53+
54+
[[nodiscard]] inline auto as_ecsact() const noexcept -> ecsact_entity_id {
55+
return reinterpret_cast<const ecsact_entity_id&>(_id);
56+
}
57+
58+
[[nodiscard]] inline auto as_entt() const noexcept -> ::entt::entity {
59+
return reinterpret_cast<const ::entt::entity&>(_id);
60+
}
61+
};
62+
63+
} // namespace ecsact::entt

ecsact/entt/error_check.hh

Lines changed: 64 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -1,64 +1,64 @@
1-
#pragma once
2-
3-
#include <vector>
4-
#include <unordered_map>
5-
#include <cassert>
6-
#include <span>
7-
#include <type_traits>
8-
#include "ecsact/runtime/common.h"
9-
#include "ecsact/runtime/core.h"
10-
#include "entt/entity/registry.hpp"
11-
#include "ecsact/entt/entity.hh"
12-
13-
namespace ecsact::entt::detail {
14-
template<typename>
15-
constexpr bool error_check_unimplemented_by_codegen = false;
16-
}
17-
18-
namespace ecsact::entt {
19-
20-
template<typename C>
21-
auto check_add_component_error( //
22-
::entt::registry&,
23-
::ecsact::entt::entity_id,
24-
const C&
25-
) -> ecsact_add_error {
26-
static_assert(detail::error_check_unimplemented_by_codegen<C>, R"(
27-
-----------------------------------------------------------------------------
28-
| (!) CODEGEN ERROR |
29-
| `check_add_component_error<>` template specialization cannot be found. This |
30-
| is typically generated by ecsact_rt_entt_codegen. |
31-
-----------------------------------------------------------------------------
32-
)");
33-
}
34-
35-
template<typename C>
36-
auto check_update_component_error( //
37-
::entt::registry&,
38-
::ecsact::entt::entity_id,
39-
const C&
40-
) -> ecsact_update_error {
41-
static_assert(detail::error_check_unimplemented_by_codegen<C>, R"(
42-
-----------------------------------------------------------------------------
43-
| (!) CODEGEN ERROR |
44-
| `check_update_component_error<>` template specialization cannot be found. |
45-
| This is typically generated by ecsact_rt_entt_codegen. |
46-
-----------------------------------------------------------------------------
47-
)");
48-
}
49-
50-
template<typename A>
51-
auto check_action_error( //
52-
::entt::registry&,
53-
const A&
54-
) -> ecsact_execute_systems_error {
55-
static_assert(detail::error_check_unimplemented_by_codegen<A>, R"(
56-
-----------------------------------------------------------------------------
57-
| (!) CODEGEN ERROR |
58-
| `check_action_error<>` template specialization cannot be found. |
59-
| This is typically generated by ecsact_rt_entt_codegen. |
60-
-----------------------------------------------------------------------------
61-
)");
62-
}
63-
64-
} // namespace ecsact::entt
1+
#pragma once
2+
3+
#include <vector>
4+
#include <unordered_map>
5+
#include <cassert>
6+
#include <span>
7+
#include <type_traits>
8+
#include "ecsact/runtime/common.h"
9+
#include "ecsact/runtime/core.h"
10+
#include "entt/entity/registry.hpp"
11+
#include "ecsact/entt/entity.hh"
12+
13+
namespace ecsact::entt::detail {
14+
template<typename>
15+
constexpr bool error_check_unimplemented_by_codegen = false;
16+
}
17+
18+
namespace ecsact::entt {
19+
20+
template<typename C>
21+
auto check_add_component_error( //
22+
::entt::registry&,
23+
::ecsact::entt::entity_id,
24+
const C&
25+
) -> ecsact_add_error {
26+
static_assert(detail::error_check_unimplemented_by_codegen<C>, R"(
27+
-----------------------------------------------------------------------------
28+
| (!) CODEGEN ERROR |
29+
| `check_add_component_error<>` template specialization cannot be found. This |
30+
| is typically generated by ecsact_rt_entt_codegen. |
31+
-----------------------------------------------------------------------------
32+
)");
33+
}
34+
35+
template<typename C>
36+
auto check_update_component_error( //
37+
::entt::registry&,
38+
::ecsact::entt::entity_id,
39+
const C&
40+
) -> ecsact_update_error {
41+
static_assert(detail::error_check_unimplemented_by_codegen<C>, R"(
42+
-----------------------------------------------------------------------------
43+
| (!) CODEGEN ERROR |
44+
| `check_update_component_error<>` template specialization cannot be found. |
45+
| This is typically generated by ecsact_rt_entt_codegen. |
46+
-----------------------------------------------------------------------------
47+
)");
48+
}
49+
50+
template<typename A>
51+
auto check_action_error( //
52+
::entt::registry&,
53+
const A&
54+
) -> ecsact_execute_systems_error {
55+
static_assert(detail::error_check_unimplemented_by_codegen<A>, R"(
56+
-----------------------------------------------------------------------------
57+
| (!) CODEGEN ERROR |
58+
| `check_action_error<>` template specialization cannot be found. |
59+
| This is typically generated by ecsact_rt_entt_codegen. |
60+
-----------------------------------------------------------------------------
61+
)");
62+
}
63+
64+
} // namespace ecsact::entt

ecsact/entt/registry_util.hh

Lines changed: 33 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,33 @@
1-
#pragma once
2-
3-
#include <cassert>
4-
#include "entt/entity/registry.hpp"
5-
#include "ecsact/entt/detail/globals.hh"
6-
7-
namespace ecsact::entt {
8-
9-
inline auto get_registry( //
10-
ecsact_registry_id id
11-
) -> ::entt::registry& {
12-
using ecsact::entt::detail::globals::registries;
13-
14-
// Check to make sure we're not trying to get a registry that doesn't exist
15-
// or has been destroyed.
16-
assert(registries.contains(id));
17-
return registries.at(id);
18-
}
19-
20-
inline auto create_registry()
21-
-> std::tuple<ecsact_registry_id, ::entt::registry&> {
22-
using ecsact::entt::detail::globals::last_registry_id;
23-
using ecsact::entt::detail::globals::registries;
24-
25-
auto registry_id = static_cast<ecsact_registry_id>(
26-
++reinterpret_cast<int32_t&>(last_registry_id)
27-
);
28-
auto& registry = registries[registry_id];
29-
30-
return {registry_id, std::ref(registry)};
31-
}
32-
33-
} // namespace ecsact::entt
1+
#pragma once
2+
3+
#include <cassert>
4+
#include "entt/entity/registry.hpp"
5+
#include "ecsact/entt/detail/globals.hh"
6+
7+
namespace ecsact::entt {
8+
9+
inline auto get_registry( //
10+
ecsact_registry_id id
11+
) -> ::entt::registry& {
12+
using ecsact::entt::detail::globals::registries;
13+
14+
// Check to make sure we're not trying to get a registry that doesn't exist
15+
// or has been destroyed.
16+
assert(registries.contains(id));
17+
return registries.at(id);
18+
}
19+
20+
inline auto create_registry()
21+
-> std::tuple<ecsact_registry_id, ::entt::registry&> {
22+
using ecsact::entt::detail::globals::last_registry_id;
23+
using ecsact::entt::detail::globals::registries;
24+
25+
auto registry_id = static_cast<ecsact_registry_id>(
26+
++reinterpret_cast<int32_t&>(last_registry_id)
27+
);
28+
auto& registry = registries[registry_id];
29+
30+
return {registry_id, std::ref(registry)};
31+
}
32+
33+
} // namespace ecsact::entt

0 commit comments

Comments
 (0)