16
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-07-19 09:59:18 +02:00

ECS System WIP

This commit is contained in:
2026-04-07 23:40:03 +02:00
parent f6db9978d2
commit 8e9fd9225f
30 changed files with 1133 additions and 242 deletions

69
entitysystem/ECScene.cpp Normal file
View File

@@ -0,0 +1,69 @@
//
// Created by Daniu
//
#include "ECScene.h"
#include "utilities/Logs.h"
ECScene::ECScene()
: m_loaded(false)
{
}
ECScene::~ECScene()
{
Unload();
}
void ECScene::Load()
{
if (m_loaded)
return;
m_systems.Create(m_world);
OnLoad();
m_loaded = true;
}
void ECScene::Unload()
{
if (!m_loaded)
return;
OnUnload();
m_world.Clear();
m_loaded = false;
}
void ECScene::Update(float dt)
{
if (!m_loaded){
return;
}
m_systems.Update(m_world, dt);
OnUpdate(dt);
}
ECWorld& ECScene::World()
{
return m_world;
}
const ECWorld& ECScene::World() const
{
return m_world;
}
void ECScene::OnLoad()
{
}
void ECScene::OnUnload()
{;
}
void ECScene::OnUpdate(float dt)
{
(void)dt;
}