Added live reloading for quake maps

This commit is contained in:
Antoine Pilote
2024-09-01 23:04:34 -04:00
parent 63712edc6d
commit d289c5431d
8 changed files with 60 additions and 14 deletions

View File

@@ -261,6 +261,24 @@ namespace Nuake
void Scene::Update(Timestep ts)
{
const auto& view = m_Registry.view<QuakeMapComponent>();
for (const auto& e : view)
{
auto& map = view.get<QuakeMapComponent>(e);
if (map.AutoRebuild && !map.Path.empty())
{
if (auto file = FileSystem::GetFile(map.Path); file->IsValid() && file->GetHasBeenModified())
{
file->SetHasBeenModified(false);
Entity entity = Entity(e, this);
QuakeMapBuilder builder;
builder.BuildQuakeMap(entity, map.HasCollisions);
}
}
}
for (auto& system : m_Systems)
{
system->Update(ts);