Base class for all logic components that can be attached to an actor. Provides access to the scene, tick functionality, and lifecycle events.
More...
#include <LogicComponent.h>
|
| | Logic (Entities::Scene *owningScene) |
| | Constructs a logic component owned by a scene.
|
| | Logic (const Entities::SpawnContext &context) |
| | Constructs a logic component from spawn context data.
|
| virtual | ~Logic ()=default |
| | Destroys the logic component.
|
| virtual std::string | getComponentName () const |
| | Gets the component type name for debugging/UI.
|
| virtual bool | drawImGui () |
| | Draws component-specific ImGui inspector controls.
|
| virtual bool | drawImGuiName () |
| | Used to alter the name of the entity in the outliner.
|
| virtual void | beginPlay () |
| | Called when the component is added to the scene or the game starts.
|
| virtual void | tick (double deltaTime) |
| | Called every frame if ticking is enabled.
|
| virtual void | endPlay () |
| | Called when the component is removed or the game ends.
|
| bool | hasBegunPlay () const |
| | Checks whether beginPlay() has been called without a matching endPlay().
|
| bool | canTick () const |
| | Checks if the component is currently set to tick.
|
| void | setCanTick (bool enable) |
| | Enables or disables ticking for this component.
|
| Entities::Entity * | getOwningEntity () const |
| | Gets the entity this component belongs to.
|
|
| static constexpr bool | IsUnique = false |
| | Defines whether multiple instances of this component can exist on the same entity. Defaults to false (multiple allowed). Override in derived classes with static constexpr bool IsUnique =
true; if needed.
|
| static constexpr const char * | ComponentName = "Logic" |
| | Fallback component type name. Derived classes may override getComponentName() for custom labels.
|
Base class for all logic components that can be attached to an actor. Provides access to the scene, tick functionality, and lifecycle events.
Definition at line 24 of file LogicComponent.h.
◆ Logic() [1/2]
◆ Logic() [2/2]
Constructs a logic component from spawn context data.
- Parameters
-
| context | Spawn context containing the owning scene. |
◆ ~Logic()
| virtual Engine::Components::Logic::~Logic |
( |
| ) |
|
|
virtualdefault |
Destroys the logic component.
◆ beginPlay()
| virtual void Engine::Components::Logic::beginPlay |
( |
| ) |
|
|
virtual |
◆ canTick()
| bool Engine::Components::Logic::canTick |
( |
| ) |
const |
|
nodiscard |
Checks if the component is currently set to tick.
- Returns
- true if ticking is enabled.
◆ drawImGui()
| virtual bool Engine::Components::Logic::drawImGui |
( |
| ) |
|
|
virtual |
◆ drawImGuiName()
| virtual bool Engine::Components::Logic::drawImGuiName |
( |
| ) |
|
|
virtual |
Used to alter the name of the entity in the outliner.
- Returns
- true if the component drew its own inspector UI.
◆ endPlay()
| virtual void Engine::Components::Logic::endPlay |
( |
| ) |
|
|
virtual |
◆ getComponentName()
| virtual std::string Engine::Components::Logic::getComponentName |
( |
| ) |
const |
|
nodiscardvirtual |
◆ getOwningEntity()
Gets the entity this component belongs to.
- Returns
- Pointer to the owning Entity.
◆ getScene()
Gets the scene this component belongs to.
- Returns
- Pointer to the owning Scene.
◆ getSceneManager()
Helper to get the SceneManager from the owning scene.
- Returns
- Pointer to the SceneManager.
◆ hasBegunPlay()
| bool Engine::Components::Logic::hasBegunPlay |
( |
| ) |
const |
|
nodiscard |
Checks whether beginPlay() has been called without a matching endPlay().
- Returns
- true while the component is in play.
◆ setCanTick()
| void Engine::Components::Logic::setCanTick |
( |
bool | enable | ) |
|
Enables or disables ticking for this component.
- Parameters
-
| enable | True to enable ticking, false to disable. |
◆ setOwningEntity()
Sets the owning entity. Called by Entity::addComponent().
- Parameters
-
| entity | Pointer to the owning entity. |
◆ tick()
| virtual void Engine::Components::Logic::tick |
( |
double | deltaTime | ) |
|
|
virtual |
◆ ComponentName
| const char* Engine::Components::Logic::ComponentName = "Logic" |
|
staticconstexpr |
Fallback component type name. Derived classes may override getComponentName() for custom labels.
Definition at line 38 of file LogicComponent.h.
◆ hasBegunPlay_
| bool Engine::Components::Logic::hasBegunPlay_ = false |
|
private |
◆ IsUnique
| bool Engine::Components::Logic::IsUnique = false |
|
staticconstexpr |
Defines whether multiple instances of this component can exist on the same entity. Defaults to false (multiple allowed). Override in derived classes with static constexpr bool IsUnique =
true; if needed.
Definition at line 32 of file LogicComponent.h.
◆ owningEntity_
◆ scene_
◆ tickEnabled
| bool Engine::Components::Logic::tickEnabled = false |
|
private |
The documentation for this class was generated from the following file:
- /workspace/magerbeton/gl3-vulkan/code/Engine/include/Engine/Component/LogicComponent.h