43 lines
1.1 KiB
C++
43 lines
1.1 KiB
C++
#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 |