Vulkan Schnee 0.0.1
High-performance rendering engine
Loading...
Searching...
No Matches
LogicComponent.h
Go to the documentation of this file.
1#pragma once
2
3namespace EngineCore {
4 class Scene;
5 class SceneManager;
6 class Entity;
7
15 public:
19 static constexpr bool IsUnique = false;
20
21 explicit LogicComponent(Scene* owningScene);
22 virtual ~LogicComponent() = default;
23
27 virtual void beginPlay();
28
33 virtual void tick(double deltaTime);
34
38 virtual void endPlay();
39
44 [[nodiscard]] bool canTick() const;
45
50 void setCanTick(bool enable);
51
56 [[nodiscard]] Entity* getOwningEntity() const;
57
58 protected:
63 [[nodiscard]] Scene* getScene() const;
64
69 [[nodiscard]] SceneManager* getSceneManager() const;
70
71 private:
72 friend class Entity;
73
78 void setOwningEntity(Entity* entity);
79
80 Scene* scene = nullptr;
82 bool tickEnabled = false;
83 };
84}
85
86
87
88
89
90
91
92
93
94
The entity class is the base class of everything which is attached to a scene. If it is part of a sce...
Definition Entity.h:18
virtual void endPlay()
Called when the component is removed or the game ends.
Scene * getScene() const
Gets the scene this component belongs to.
virtual ~LogicComponent()=default
SceneManager * getSceneManager() const
Helper to get the SceneManager from the owning scene.
void setCanTick(bool enable)
Enables or disables ticking for this component.
void setOwningEntity(Entity *entity)
Sets the owning entity. Called by Entity::addComponent().
bool canTick() const
Checks if the component is currently set to tick.
virtual void tick(double deltaTime)
Called every frame if ticking is enabled.
virtual void beginPlay()
Called when the component is added to the scene or the game starts.
static constexpr bool IsUnique
Defines whether multiple instances of this component can exist on the same entity....
LogicComponent(Scene *owningScene)
Entity * getOwningEntity() const
Gets the entity this component belongs to.
Manages game objects within a scene, handling registration, ID allocation, and GPU buffer synchroniza...
A scene is the overarching structure which can spawn actors.
Definition Scene.h:17
Log category system implementation.