Skip to main content

gameObject Folder

Folders Index

folderbuilders

Files Index

filehelios/engine/builder/gameObject/_module.ixx

Module aggregation for helios.engine.builder.gameObject. More...

fileGameObjectFactory.ixx

Factory for creating and cloning GameObjects with fluent configuration. More...

Description

helios::engine::builder::gameObject

Factory and prototype classes for constructing GameObjects with fluent configuration.

Overview

This submodule contains the core factory pattern implementation for entity creation. The GameObjectFactory provides static methods for creating new entities or cloning existing ones, while GameObjectPrototype enables fluent, callback-based component configuration.

Key Classes

ClassPurpose
GameObjectFactoryStatic factory for entity creation and cloning
GameObjectPrototypeInternal builder holding all domain-specific builders

API

GameObjectFactory

 // Create a new empty GameObject
 auto prototype = GameObjectFactory::gameObject();
 
 // Clone an existing GameObject (copies all Cloneable components)
 auto prototype = GameObjectFactory::from(existingGameObject);

GameObjectPrototype

 prototype
  .withMotion([](MotionBuilder& b) { /* configure motion */ })
  .withRendering([](RenderingBuilder& b) { /* configure rendering */ })
  .withCollision([](CollisionBuilder& b) { /* configure collision */ })
  .withTransform([](TransformBuilder& b) { /* configure transform */ })
  .withUiTransform([](UiTransformBuilder& b) { /* configure UI transform */ })
  .withEffects([](EffectsBuilder& b) { /* configure effects */ })
  .withSpawn([](SpawnBuilder& b) { /* configure spawn */ })
  .withAi([](AiBuilder& b) { /* configure AI */ })
  .withCombat([](CombatBuilder& b) { /* configure weapons */ })
  .withLifecycle([](LifecycleBuilder& b) { /* configure lifecycle */ })
  .withHealth([](HealthBuilder& b) { /* configure health */ })
  .withScoring([](ScoringBuilder& b) { /* configure scoring */ })
  .withObserver([](ObserverBuilder& b) { /* configure observers */ })
  .make(active); // Returns std::unique_ptr<GameObject>

Cloning Behavior

When using GameObjectFactory::from(), only components implementing the Cloneable interface are copied. Components that add dependent components in onAttach() will have those dependencies resolved via getOrAdd() to prevent duplicates.

Related Modules

ModulePurpose
helios.engine.builder.gameObject.buildersDomain-specific builders
helios.engine.ecsGameObject, Component, Cloneable


Generated via doxygen2docusaurus 2.0.0 by Doxygen 1.15.0.