Initial commit - restart from existing code

This commit is contained in:
Tom Ray
2026-02-13 19:15:05 +01:00
parent 11df621bb2
commit 7c352bc280
1906 changed files with 491226 additions and 0 deletions

View File

@@ -0,0 +1,61 @@
#include "CScene.hpp"
#include "nlohmann/json_fwd.hpp"
#include "../Component/Graphics/CTestRenderer.hpp"
//#include "../../Controller/Exception/CRuntimeException.hpp"
//#include "Components/CAbstractScript.hpp"
namespace CosmicCore {
CScene::CScene(std::string name) : CSerializable(),
m_name(std::move(name)) {
}
std::string CScene::getName(void) const {
return m_name;
}
unsigned int CScene::getNumEntity(void) const {
return this->m_ecManager.view<CMetaData>()->size();
}
void CScene::removeEntity(unsigned int index, bool destroy)
{
}
void CScene::render(){
auto renderers = m_ecManager.view<CTestRenderer>();
for(auto beg = renderers->begin(); beg != renderers->end(); ++beg)
{
beg->render();
}
//std::chrono::steady_clock::time_point begin1 = std::chrono::steady_clock::now();
//auto eh = m_ecManager.create();
//m_ecManager.emplace<CTestRenderer>(eh, nullptr);
//std::chrono::steady_clock::time_point end1 = std::chrono::steady_clock::now();
//std::cout << "added entity and comptest : " <<std::chrono::duration_cast<std::chrono::seconds>(end1 - begin1).count() << std::endl;
//static unsigned int entitynb = 0;
//entitynb++;
//std::chrono::steady_clock::time_point begin = std::chrono::steady_clock::now();
//m_ecManager.view<CTestRenderer>().each([](auto e, CTestRenderer& comp){comp.render();});
//std::chrono::steady_clock::time_point end = std::chrono::steady_clock::now();
//std::cout << "render func : " << std::chrono::duration_cast<std::chrono::seconds>(end - begin).count() << std::endl;
//std::cout << "nb : " << entitynb << std::endl;
}
// void CScene::setMask(unsigned int mask)
// {
// m_maskLayer = mask;
// }
// unsigned int CScene::getMask(void)
// {
// return m_maskLayer;
// }
nlohmann::json CScene::to_json()
{
return nlohmann::json();
}
}