mitiru::ecs

Lightweight entity-component-system used by the engine's runtime scenes and gameplay code.

Lightweight entity-component-system used by the engine's runtime scenes and gameplay code.

NameKindItems
ComponentRegistryclass7
BenchmarkResultstruct8
BenchmarkConfigstruct4
ECSBenchmarkclass10
EnttWorldclass11
CommonTagenum9
MitiruWorldclass14
PrefabComponentstruct2
Prefabstruct2
PrefabLibraryclass8
SystemEntrystruct3
SystemSchedulerclass7

Free functions and typedefs

using ComponentSerializer = std::function<std::string(const void*)>;
class ComponentRegistry 7
template <typename T> void registerType(std::string name, ComponentSerializer serializer)
[[nodiscard]] std::string serialize(sgc::TypeIdValue typeId, const void* data) const
[[nodiscard]] std::vector<std::string> registeredNames() const
template <typename T> [[nodiscard]] bool isRegistered() const
[[nodiscard]] std::size_t size() const noexcept
[[nodiscard]] std::string toJson() const
using BenchmarkFunc = std::function<void()>;
struct BenchmarkResult 8
std::string name
double totalMs = 0.0
double averageMs = 0.0
double minMs = 0.0
double maxMs = 0.0
std::uint64_t entityCount = 0
std::uint64_t iterations = 0
double entitiesPerSecond = 0.0
struct BenchmarkConfig 4
int warmupIterations = 5
int measureIterations = 100
int entityCount = 10000
bool verbose = false
class ECSBenchmark 10
ECSBenchmark() = default
~ECSBenchmark() = default
ECSBenchmark(const ECSBenchmark&) = delete
ECSBenchmark& operator=(const ECSBenchmark&) = delete
ECSBenchmark(ECSBenchmark&&) noexcept = default
ECSBenchmark& operator=(ECSBenchmark&&) noexcept = default
void configure(const BenchmarkConfig& config)
void addBenchmark(const std::string& name, std::uint64_t entityCount, BenchmarkFunc func)
[[nodiscard]] std::vector<BenchmarkResult> runAll()
[[nodiscard]] static std::string formatReport( const std::vector<BenchmarkResult>& results)
class EnttWorld 11
using Entity = entt::entity;
[[nodiscard]] Entity createEntity(const std::string& name = "")
void destroyEntity(Entity entity)
template<typename T, typename... Args> T& addComponent(Entity entity, Args&&... args)
template<typename T> T* getComponent(Entity entity)
template<typename T> bool hasComponent(Entity entity) const
template<typename... Components> auto view()
[[nodiscard]] std::size_t entityCount() const noexcept
[[nodiscard]] entt::registry& registry() noexcept
[[nodiscard]] const entt::registry& registry() const noexcept
[[nodiscard]] std::string entityName(Entity entity) const
enum CommonTag : std::uint8_t 9
Player
Enemy
Platform
Collectible
UI
Camera
Trigger
Count
using CommonTagSet = std::bitset<static_cast<std::size_t>(CommonTag::Count)>;
class MitiruWorld 14
[[nodiscard]] sgc::ecs::World& world() noexcept
[[nodiscard]] const sgc::ecs::World& world() const noexcept
void addCommonTag(sgc::ecs::Entity entity, CommonTag tag)
void removeCommonTag(sgc::ecs::Entity entity, CommonTag tag)
[[nodiscard]] bool hasCommonTag(sgc::ecs::Entity entity, CommonTag tag) const
[[nodiscard]] CommonTagSet getCommonTags(sgc::ecs::Entity entity) const
void setTag(sgc::ecs::Entity entity, std::string tag)
[[nodiscard]] std::string getTag(sgc::ecs::Entity entity) const
void addLabel(sgc::ecs::Entity entity, const std::string& label)
[[nodiscard]] bool hasLabel(sgc::ecs::Entity entity, const std::string& label) const
void removeLabel(sgc::ecs::Entity entity, const std::string& label)
[[nodiscard]] std::size_t entityCount() const noexcept
[[nodiscard]] std::string snapshot() const
void destroyEntity(sgc::ecs::Entity entity)
struct PrefabComponent 2
std::string name
std::string jsonData
struct Prefab 2
std::string name
std::vector<PrefabComponent> components
class PrefabLibrary 8
void add(Prefab prefab)
[[nodiscard]] std::optional<Prefab> get(const std::string& name) const
[[nodiscard]] bool has(const std::string& name) const
void remove(const std::string& name)
[[nodiscard]] std::vector<std::string> listNames() const
[[nodiscard]] static std::string toJson(const Prefab& prefab)
[[nodiscard]] static Prefab fromJson(const std::string& jsonStr)
[[nodiscard]] std::size_t size() const noexcept
struct SystemEntry 3
std::string name
int priority = 0
std::function<void(float)> updateFn
class SystemScheduler 7
void addSystem(SystemEntry entry)
void removeSystem(const std::string& name)
void update(float dt)
[[nodiscard]] std::vector<std::string> systemNames() const
[[nodiscard]] std::string toJson() const
[[nodiscard]] std::size_t size() const noexcept
void clear() noexcept

Sourced from docs/API_CATALOG.md, auto-generated by tools/generate_api_catalog.py.