GameWorld.ixx File
Central registry for managing game entities. More...
Included Headers
#include <cassert>
#include <format>
#include <memory>
#include <optional>
#include <span>
#include <string>
#include <unordered_map>
#include <helios.engine.runtime.spawn.SpawnCommandHandlerRegistry>
#include <helios.engine.core.data>
#include <helios.engine.runtime.world.UpdateContext>
#include <helios.engine.ecs.EntityRegistry>
#include <helios.engine.ecs.GameObject>
#include <helios.engine.runtime.spawn.SpawnCommandHandler>
#include <helios.util.log.Logger>
#include <helios.engine.runtime.world.Manager>
#include <helios.engine.runtime.world.Level>
#include <helios.engine.ecs.EntityManager>
#include <helios.util.Guid>
#include <helios.engine.ecs.View>
#include <helios.util.log.LogManager>
#include <helios.engine.mechanics.scoring.ScoreCommandHandler>
#include <helios.engine.ecs.EntityHandle>
Namespaces Index
| namespace | helios |
| namespace | engine |
|
Main engine module aggregating core infrastructure and game systems. More... | |
| namespace | runtime |
|
Runtime infrastructure for game execution and lifecycle orchestration. More... | |
| namespace | world |
|
World state management and per-frame update context. More... | |
Classes Index
| class | GameWorld |
|
Central registry for game entities, managers, pools, and the active level. More... | |
Macro Definitions Index
| #define | HELIOS_LOG_SCOPE "helios::engine::runtime::world::GameWorld" |
Description
Central registry for managing game entities.
Macro Definitions
HELIOS_LOG_SCOPE
|
Definition at line 43 of file GameWorld.ixx.
43#define HELIOS_LOG_SCOPE "helios::engine::runtime::world::GameWorld"
File Listing
The file content with the documentation metadata removed is:
43#define HELIOS_LOG_SCOPE "helios::engine::runtime::world::GameWorld"
44export namespace helios::engine::runtime::world {
134 std::unordered_map<helios::util::Guid, std::unique_ptr<helios::engine::ecs::GameObject>> gameObjects_;
142 inline static const helios::util::log::Logger& logger_ = helios::util::log::LogManager::loggerForScope(
143 HELIOS_LOG_SCOPE);
194 mutable helios::engine::ecs::EntityManager em_;
203 * It facilitates the lifecycle of entities, oversees component-based management, coordinates Managers,
217 for (auto& mgr : managers_) {
237 return level_ != nullptr;
247 [[nodiscard]] const helios::engine::runtime::world::Level& level() const noexcept{
248 return *level_;
260 [[nodiscard]] bool hasManager() const {
261 return getManager<T>() != nullptr;
281 T& addManager(Args&&... args) {
283 assert(!hasManager<T>() && "Manager already registered.");
288 managers_.push_back(std::move(manager));
306 const helios::engine::core::data::SpawnProfileId spawnProfileId,
307 helios::engine::runtime::spawn::SpawnCommandHandler& poolManager
309 bool added = spawnCommandHandlerRegistry_.add(spawnProfileId, poolManager);
330 const helios::engine::core::data::SpawnProfileId spawnProfileId) {
331 return spawnCommandHandlerRegistry_.get(spawnProfileId);
347 assert(!scoreCommandHandler_ && "ScoreCommandHandler already registered");
359 [[nodiscard]] helios::engine::mechanics::scoring::ScoreCommandHandler* scoreCommandHandler() {
360 return scoreCommandHandler_;
372 [[nodiscard]] T* getManager() const {
374 for (auto& mgr : managers_) {
391 void flushManagers(helios::engine::runtime::world::UpdateContext& updateContext) {
392 for (auto& mgr : managers_) {
409 [[nodiscard]] helios::engine::ecs::GameObject addGameObject() {
410 const auto handle = em_.create();
411 return helios::engine::ecs::GameObject(handle, &em_);
439 return helios::engine::ecs::View<Components...>(&em_);
451 return helios::engine::ecs::View<Components...>(&em_);
464 [[nodiscard]] std::optional<helios::engine::ecs::GameObject> find(const helios::engine::ecs::EntityHandle handle) {
465 if (!em_.isValid(handle)) {
469 return helios::engine::ecs::GameObject(handle, &em_);
479 [[nodiscard]] std::optional<helios::engine::ecs::GameObject> find(const helios::engine::ecs::EntityHandle handle) const {
481 if (!em_.isValid(handle)) {
485 return helios::engine::ecs::GameObject(handle, &em_);
501 [[nodiscard]] helios::engine::ecs::GameObject clone(const helios::engine::ecs::GameObject gameObject) {
503 auto newGo = addGameObject();
507 em_.clone(gameObject.entityHandle(), newGo.entityHandle());
Generated via doxygen2docusaurus 2.0.0 by Doxygen 1.15.0.