Initial commit - restart from existing code
This commit is contained in:
43
src/Engine/Core/Component/CAbstractComponent.hpp
Normal file
43
src/Engine/Core/Component/CAbstractComponent.hpp
Normal file
@@ -0,0 +1,43 @@
|
||||
#ifndef CABSTRACT_COMPONENT_HPP
|
||||
#define CABSTRACT_COMPONENT_HPP
|
||||
|
||||
#include "../Utils/CSerializable.hpp"
|
||||
#include "../Entity/CEntity.hpp"
|
||||
namespace CosmicCore {
|
||||
|
||||
/**
|
||||
* @brief Enum representing every type of component that can be created.
|
||||
*/
|
||||
enum class EComponentType : unsigned char {
|
||||
COMPONENT_SCRIPT,
|
||||
COMPONENT_CAMERA,
|
||||
COMPONENT_LIGHT,
|
||||
COMPONENT_RIGIDBODY,
|
||||
COMPONENT_COLLIDER,
|
||||
COMPONENT_CUSTOM,
|
||||
COMPONENT_RENDERER,
|
||||
COMPONENT_META,
|
||||
COMPONENT_COUNT
|
||||
};
|
||||
|
||||
constexpr std::string typeToString(EComponentType type);
|
||||
|
||||
class CAbstractComponent : public CSerializable{
|
||||
public:
|
||||
CAbstractComponent(CEntity& entity): m_owningEntity(entity){};
|
||||
virtual ~CAbstractComponent() = default;
|
||||
|
||||
CEntity& getEntity() {
|
||||
return m_owningEntity;
|
||||
}
|
||||
|
||||
virtual nlohmann::json to_json() = 0;
|
||||
private:
|
||||
/**
|
||||
* @brief The entity to which the component is linked.
|
||||
*/
|
||||
CEntity m_owningEntity;
|
||||
};
|
||||
}
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user