GameWorld.ixx File
Central game state container for entities, resources, and the active level. More...
Included Headers
#include <cassert>
#include <format>
#include <helios-engine-config.h>
#include <memory>
#include <span>
#include <string>
#include <helios.engine.runtime.world.concepts>
#include <helios.engine.runtime.world.EngineWorld>
#include <helios.ecs.View>
#include <helios.engine.util.log.LogManager>
#include <helios.engine.util.log.Logger>
#include <helios.engine.util.Guid>
#include <helios.engine.runtime.world.Level>
#include <helios.engine.runtime.world.Manager>
#include <helios.engine.runtime.messaging.command.concepts>
#include <helios.engine.runtime.world.types.GameObjectHandle>
#include <helios.engine.runtime.world.Session>
#include <helios.engine.runtime.world.types.GameObjectId>
#include <helios.engine.core.thread.JobSystem>
#include <helios.engine.runtime.timing.TimerManager>
#include <helios.engine.runtime.world.UpdateContext>
#include <helios.ecs.Entity>
#include <helios.engine.platform.environment.types>
#include <helios.engine.runtime.world.ManagerRegistry>
#include <helios.engine.runtime.messaging.command.CommandHandlerRegistry>
#include <helios.engine.runtime.world.ResourceRegistry>
#include <helios.engine.runtime.messaging.command.CommandBufferRegistry>
#include <helios.engine.runtime.world.RuntimeEnvironment>
#include <helios.engine.runtime.world.GameObject>
Namespaces Index
| namespace | helios |
| namespace | engine |
| namespace | runtime |
| namespace | world |
Classes Index
| class | GameWorld |
|
Runtime root object coordinating world domains, resources, and frame services. More... | |
Macro Definitions Index
| #define | HELIOS_LOG_SCOPE "GameWorld" |
Description
Central game state container for entities, resources, and the active level.
Macro Definitions
HELIOS_LOG_SCOPE
|
Definition at line 57 of file GameWorld.ixx.
57#define HELIOS_LOG_SCOPE "GameWorld"
File Listing
The file content with the documentation metadata removed is:
9#include <helios-engine-config.h>
50using namespace helios::engine::core::thread;
51using namespace helios::engine::runtime::timing;
53using namespace helios::engine::runtime::messaging::command;
55using namespace helios::engine::platform::environment::types;
56using namespace helios::engine::runtime::world::types;
57#define HELIOS_LOG_SCOPE "GameWorld"
58export namespace helios::engine::runtime::world {
80 inline static const helios::engine::util::log::Logger& logger_ = helios::engine::util::log::LogManager::loggerForScope(
81 HELIOS_LOG_SCOPE);
138 explicit GameWorld(JobSystem& jobSystem, const size_t capacity = ENTITY_MANAGER_DEFAULT_CAPACITY)
139 : session_(Session(engineWorld_.add<GameObjectHandle>())),
141 jobSystem_(jobSystem)
158 return session_;
167 return jobSystem_;
175 [[nodiscard]] RuntimeEnvironment& runtimeEnvironment() {
176 return runtimeEnvironment_;
191 for (auto& mgr : resourceRegistry_.managers()) {
192 mgr->init(commandHandlerRegistry_);
195 for (auto& buff : resourceRegistry_.commandBuffers()) {
217 return level_ != nullptr;
228 return level_.get();
239 requires IsManagerLike<T>
240 [[nodiscard]] bool hasManager() const {
241 return resourceRegistry_.has<T>();
252 requires IsCommandBufferLike<T>
253 [[nodiscard]] bool hasCommandBuffer() const {
254 return resourceRegistry_.has<T>();
271 template<typename T, typename... Args>
272 requires IsManagerLike<T>
273 T& registerManager(Args&&... args) {
274 return resourceRegistry_.emplace<T>(std::forward<Args>(args)...);
291 template<typename T, typename... Args>
292 requires IsCommandBufferLike<T>
293 T& registerCommandBuffer(Args&&... args) {
294 return resourceRegistry_.emplace<T>(std::forward<Args>(args)...);
307 requires IsManagerLike<T>
309 assert(resourceRegistry_.has<T>() && "Manager not registered");
310 return resourceRegistry_.get<T>();
321 requires IsManagerLike<T>
322 T* tryManager() const noexcept {
323 return resourceRegistry_.tryGet<T>();
334 requires IsCommandBufferLike<T>
335 T* tryCommandBuffer() const noexcept {
336 return resourceRegistry_.tryGet<T>();
350 requires IsCommandBufferLike<T>
351 T& commandBuffer() const noexcept {
352 return resourceRegistry_.get<T>();
371 template<typename... CommandType, typename OwningT>
372 requires IsCommandHandlerLike<OwningT, CommandType...>
373 void registerCommandHandler(OwningT& owner) {
374 (commandHandlerRegistry_.template registerHandler<CommandType>(owner), ...);
383 return commandHandlerRegistry_;
394 for (auto& mgr : resourceRegistry_.managers()) {
395 mgr->reset();
411 return resourceRegistry_;
417 const ResourceRegistry& resourceRegistry() const noexcept {
418 return resourceRegistry_;
426 [[nodiscard]] PlatformWorld& platformWorld() noexcept{
427 return engineWorld_.platformWorld();
436 return engineWorld_.renderResourceWorld();
445 return engineWorld_.renderTargetWorld();
454 return engineWorld_.gameObjectWorld();
463 [[nodiscard]] EngineWorld& engineWorld() noexcept{
464 return engineWorld_;
475 template <typename THandle, typename... Components>
477 return engineWorld_.view<THandle, Components...>();
491 return engineWorld_.template find<THandle>(handle);
504 [[nodiscard]] auto add(const typename THandle::StrongId_type strongId = typename THandle::StrongId_type{}, const bool isActive = true) noexcept {
505 auto entity = engineWorld_.template add<THandle>(strongId);
506 entity.setActive(isActive);
507 return entity;
521 return engineWorld_.template destroy<THandle>(handle);
529 helios::engine::runtime::messaging::command::CommandBufferRegistry& commandBufferRegistry() noexcept {
530 return resourceRegistry().commandBufferRegistry();
540 return resourceRegistry().managerRegistry();
550 auto& entityManager() noexcept {
551 return engineWorld_.template entityManager<THandle>();
Generated via doxygen2docusaurus 2.0.0 by Doxygen 1.9.8.