Rework API graphique Vulkan - EnTT pour ECS + Chargement modèle 3D assimp + SDL3 pour events input et fenetre + mesh texture camera transform ok + attention tous les assets nouveaus ne sont pas commités et il y a du code test en dur dans scene addentity + restructuration globale
This commit is contained in:
@@ -4,24 +4,22 @@
|
||||
#include <forward_list>
|
||||
#include <memory>
|
||||
#include "../Utils/CSerializable.hpp"
|
||||
#include <entt/entt.hpp>
|
||||
#include "../Systems/EntityComponentManager.hpp"
|
||||
|
||||
namespace CosmicCore
|
||||
{
|
||||
class CScene;
|
||||
|
||||
class CEntity : public CSerializable {
|
||||
using ECManager = entt::registry;
|
||||
using EntityId = entt::entity;
|
||||
|
||||
private:
|
||||
|
||||
/**
|
||||
* @brief A pointer to the scene containing the entity.
|
||||
*/
|
||||
std::weak_ptr<CScene> m_scene;
|
||||
CScene* m_scene;
|
||||
|
||||
ECManager& m_registryReference;
|
||||
EntityComponentManager& m_registryReference;
|
||||
|
||||
EntityId m_handle;
|
||||
|
||||
@@ -32,7 +30,7 @@ namespace CosmicCore
|
||||
*/
|
||||
CEntity() = delete;
|
||||
|
||||
CEntity(ECManager& registry, EntityId handle);
|
||||
CEntity(EntityComponentManager& registry, EntityId handle, CScene* scene);
|
||||
|
||||
CEntity(const CEntity& cop);
|
||||
/**
|
||||
@@ -49,26 +47,34 @@ namespace CosmicCore
|
||||
template<typename compType, typename... Args>
|
||||
void addComponent(std::forward_list<Args...> args)
|
||||
{
|
||||
m_registryReference.emplace<compType>(m_handle, *this, args);
|
||||
m_registryReference().emplace<compType>(m_handle, *this, args);
|
||||
}
|
||||
|
||||
template<typename compType>
|
||||
void addComponent()
|
||||
{
|
||||
m_registryReference.emplace<compType>(m_handle, *this);
|
||||
m_registryReference().emplace<compType>(m_handle, *this);
|
||||
}
|
||||
|
||||
EntityComponentManager& getRegistry(){return m_registryReference;};
|
||||
|
||||
/**
|
||||
* @brief Getter to the entity's scene.
|
||||
* @return The pointer m_scene.
|
||||
*/
|
||||
std::weak_ptr<CScene> getScene();
|
||||
CScene* getScene();
|
||||
|
||||
/**
|
||||
* @brief Setter of the scene.
|
||||
* @param[in, out] e The scene in which the entity will be set.
|
||||
*/
|
||||
void setScene(std::weak_ptr<CScene> s);
|
||||
void setScene(CScene* s);
|
||||
|
||||
EntityId operator*(){
|
||||
return m_handle;
|
||||
}
|
||||
|
||||
//TODO GET COMPONENT VECTOR OF SPECIFIC TYPE ? si utile
|
||||
|
||||
nlohmann::json to_json();
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user