wPlot2D version: 0.1.0
A lightweight C++ library for clear and customizable 2D scientific plots.
Loading...
Searching...
No Matches
wComponent.hpp
Go to the documentation of this file.
1/*
2+---------------------------------------------------------------------------------------------------------------------------------------------------+
3Created by Wilfried Koch.
4Copyright @ 2025 Wilfried Koch. All rights reserved.
5+---------------------------------------------------------------------------------------------------------------------------------------------------+
6*/
7
8#ifndef W_COMPONENT_HPP
9#define W_COMPONENT_HPP
10
11#include <iostream>
12
13namespace wEngine
14{
15
16 class Entity;
17
32 {
33 public:
34 /*
35 * @brief Virtual destructor.
36 */
37 virtual ~Component( ) = default;
38
39 /*
40 * @brief Enables the component (makes it active).
41 */
42 virtual void enable( );
43
44 /*
45 * @brief Disables the component (makes it inactive).
46 */
47 virtual void disable( );
48
53 [[nodiscard]] bool isEnabled( ) const;
54
59 void setParent( Entity* parent );
60
65 [[nodiscard]] Entity* getParent( ) const;
66
67 protected:
68
72 Component( );
73
74 private:
75 bool mEnabled;
76 Entity* mParent;
77 };
78
79}// End of namespace wEngine
80
81#endif
Entity * getParent() const
Returns the parent entity of this component.
Definition wComponent.cpp:50
bool isEnabled() const
Checks whether the component is currently active.
Definition wComponent.cpp:40
virtual void disable()
Definition wComponent.cpp:35
void setParent(Entity *parent)
Sets the parent entity of this component.
Definition wComponent.cpp:45
virtual void enable()
Definition wComponent.cpp:30
virtual ~Component()=default
Component()
Protected constructor to restrict instantiation to derived classes.
Definition wComponent.cpp:17
Represents an entity in the ECS (Entity-Component System) architecture.
Definition wEntity.hpp:60
Definition wColorComponent.cpp:9