Skip to content

chore: cleanup line endings #91

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
126 changes: 63 additions & 63 deletions ecsact/entt/entity.hh
Original file line number Diff line number Diff line change
@@ -1,63 +1,63 @@
#pragma once
#include <cstdint>
#include "ecsact/runtime/common.h"
#include <entt/entity/entity.hpp>
namespace ecsact::entt {
/**
* The Ecsact and EnTT entity IDs are supposed to be 1:1. This class serves to
* make using either trivial.
*/
class entity_id {
std::int32_t _id;
public:
inline entity_id() {
}
inline entity_id(::entt::entity entt_entity)
: _id(reinterpret_cast<std::int32_t&>(entt_entity)) {
}
inline entity_id(ecsact_entity_id ecsact_entity)
: _id(reinterpret_cast<std::int32_t&>(ecsact_entity)) {
}
entity_id(const entity_id&) = default;
entity_id(entity_id&&) = default;
auto operator=(const entity_id&) -> entity_id& = default;
auto operator=(entity_id&&) -> entity_id& = default;
auto operator<=>(const entity_id&) const = default;
inline auto operator=(::entt::entity entt_entity) noexcept -> entity_id& {
_id = reinterpret_cast<std::int32_t&>(entt_entity);
return *this;
}
inline auto operator=(ecsact_entity_id ecsact_entity) noexcept -> entity_id& {
_id = reinterpret_cast<std::int32_t&>(ecsact_entity);
return *this;
}
inline operator ecsact_entity_id() const noexcept {
return reinterpret_cast<const ecsact_entity_id&>(_id);
}
inline operator ::entt::entity() const noexcept {
return reinterpret_cast<const ::entt::entity&>(_id);
}
[[nodiscard]] inline auto as_ecsact() const noexcept -> ecsact_entity_id {
return reinterpret_cast<const ecsact_entity_id&>(_id);
}
[[nodiscard]] inline auto as_entt() const noexcept -> ::entt::entity {
return reinterpret_cast<const ::entt::entity&>(_id);
}
};
} // namespace ecsact::entt
#pragma once

#include <cstdint>
#include "ecsact/runtime/common.h"
#include <entt/entity/entity.hpp>

namespace ecsact::entt {

/**
* The Ecsact and EnTT entity IDs are supposed to be 1:1. This class serves to
* make using either trivial.
*/
class entity_id {
std::int32_t _id;

public:
inline entity_id() {
}

inline entity_id(::entt::entity entt_entity)
: _id(reinterpret_cast<std::int32_t&>(entt_entity)) {
}

inline entity_id(ecsact_entity_id ecsact_entity)
: _id(reinterpret_cast<std::int32_t&>(ecsact_entity)) {
}

entity_id(const entity_id&) = default;
entity_id(entity_id&&) = default;

auto operator=(const entity_id&) -> entity_id& = default;
auto operator=(entity_id&&) -> entity_id& = default;

auto operator<=>(const entity_id&) const = default;

inline auto operator=(::entt::entity entt_entity) noexcept -> entity_id& {
_id = reinterpret_cast<std::int32_t&>(entt_entity);
return *this;
}

inline auto operator=(ecsact_entity_id ecsact_entity) noexcept -> entity_id& {
_id = reinterpret_cast<std::int32_t&>(ecsact_entity);
return *this;
}

inline operator ecsact_entity_id() const noexcept {
return reinterpret_cast<const ecsact_entity_id&>(_id);
}

inline operator ::entt::entity() const noexcept {
return reinterpret_cast<const ::entt::entity&>(_id);
}

[[nodiscard]] inline auto as_ecsact() const noexcept -> ecsact_entity_id {
return reinterpret_cast<const ecsact_entity_id&>(_id);
}

[[nodiscard]] inline auto as_entt() const noexcept -> ::entt::entity {
return reinterpret_cast<const ::entt::entity&>(_id);
}
};

} // namespace ecsact::entt
128 changes: 64 additions & 64 deletions ecsact/entt/error_check.hh
Original file line number Diff line number Diff line change
@@ -1,64 +1,64 @@
#pragma once
#include <vector>
#include <unordered_map>
#include <cassert>
#include <span>
#include <type_traits>
#include "ecsact/runtime/common.h"
#include "ecsact/runtime/core.h"
#include "entt/entity/registry.hpp"
#include "ecsact/entt/entity.hh"
namespace ecsact::entt::detail {
template<typename>
constexpr bool error_check_unimplemented_by_codegen = false;
}
namespace ecsact::entt {
template<typename C>
auto check_add_component_error( //
::entt::registry&,
::ecsact::entt::entity_id,
const C&
) -> ecsact_add_error {
static_assert(detail::error_check_unimplemented_by_codegen<C>, R"(
-----------------------------------------------------------------------------
| (!) CODEGEN ERROR |
| `check_add_component_error<>` template specialization cannot be found. This |
| is typically generated by ecsact_rt_entt_codegen. |
-----------------------------------------------------------------------------
)");
}
template<typename C>
auto check_update_component_error( //
::entt::registry&,
::ecsact::entt::entity_id,
const C&
) -> ecsact_update_error {
static_assert(detail::error_check_unimplemented_by_codegen<C>, R"(
-----------------------------------------------------------------------------
| (!) CODEGEN ERROR |
| `check_update_component_error<>` template specialization cannot be found. |
| This is typically generated by ecsact_rt_entt_codegen. |
-----------------------------------------------------------------------------
)");
}
template<typename A>
auto check_action_error( //
::entt::registry&,
const A&
) -> ecsact_execute_systems_error {
static_assert(detail::error_check_unimplemented_by_codegen<A>, R"(
-----------------------------------------------------------------------------
| (!) CODEGEN ERROR |
| `check_action_error<>` template specialization cannot be found. |
| This is typically generated by ecsact_rt_entt_codegen. |
-----------------------------------------------------------------------------
)");
}
} // namespace ecsact::entt
#pragma once

#include <vector>
#include <unordered_map>
#include <cassert>
#include <span>
#include <type_traits>
#include "ecsact/runtime/common.h"
#include "ecsact/runtime/core.h"
#include "entt/entity/registry.hpp"
#include "ecsact/entt/entity.hh"

namespace ecsact::entt::detail {
template<typename>
constexpr bool error_check_unimplemented_by_codegen = false;
}

namespace ecsact::entt {

template<typename C>
auto check_add_component_error( //
::entt::registry&,
::ecsact::entt::entity_id,
const C&
) -> ecsact_add_error {
static_assert(detail::error_check_unimplemented_by_codegen<C>, R"(
-----------------------------------------------------------------------------
| (!) CODEGEN ERROR |
| `check_add_component_error<>` template specialization cannot be found. This |
| is typically generated by ecsact_rt_entt_codegen. |
-----------------------------------------------------------------------------
)");
}

template<typename C>
auto check_update_component_error( //
::entt::registry&,
::ecsact::entt::entity_id,
const C&
) -> ecsact_update_error {
static_assert(detail::error_check_unimplemented_by_codegen<C>, R"(
-----------------------------------------------------------------------------
| (!) CODEGEN ERROR |
| `check_update_component_error<>` template specialization cannot be found. |
| This is typically generated by ecsact_rt_entt_codegen. |
-----------------------------------------------------------------------------
)");
}

template<typename A>
auto check_action_error( //
::entt::registry&,
const A&
) -> ecsact_execute_systems_error {
static_assert(detail::error_check_unimplemented_by_codegen<A>, R"(
-----------------------------------------------------------------------------
| (!) CODEGEN ERROR |
| `check_action_error<>` template specialization cannot be found. |
| This is typically generated by ecsact_rt_entt_codegen. |
-----------------------------------------------------------------------------
)");
}

} // namespace ecsact::entt
66 changes: 33 additions & 33 deletions ecsact/entt/registry_util.hh
Original file line number Diff line number Diff line change
@@ -1,33 +1,33 @@
#pragma once
#include <cassert>
#include "entt/entity/registry.hpp"
#include "ecsact/entt/detail/globals.hh"
namespace ecsact::entt {
inline auto get_registry( //
ecsact_registry_id id
) -> ::entt::registry& {
using ecsact::entt::detail::globals::registries;
// Check to make sure we're not trying to get a registry that doesn't exist
// or has been destroyed.
assert(registries.contains(id));
return registries.at(id);
}
inline auto create_registry()
-> std::tuple<ecsact_registry_id, ::entt::registry&> {
using ecsact::entt::detail::globals::last_registry_id;
using ecsact::entt::detail::globals::registries;
auto registry_id = static_cast<ecsact_registry_id>(
++reinterpret_cast<int32_t&>(last_registry_id)
);
auto& registry = registries[registry_id];
return {registry_id, std::ref(registry)};
}
} // namespace ecsact::entt
#pragma once

#include <cassert>
#include "entt/entity/registry.hpp"
#include "ecsact/entt/detail/globals.hh"

namespace ecsact::entt {

inline auto get_registry( //
ecsact_registry_id id
) -> ::entt::registry& {
using ecsact::entt::detail::globals::registries;

// Check to make sure we're not trying to get a registry that doesn't exist
// or has been destroyed.
assert(registries.contains(id));
return registries.at(id);
}

inline auto create_registry()
-> std::tuple<ecsact_registry_id, ::entt::registry&> {
using ecsact::entt::detail::globals::last_registry_id;
using ecsact::entt::detail::globals::registries;

auto registry_id = static_cast<ecsact_registry_id>(
++reinterpret_cast<int32_t&>(last_registry_id)
);
auto& registry = registries[registry_id];

return {registry_id, std::ref(registry)};
}

} // namespace ecsact::entt
Loading