Added Wren API endpoints + random cleanup

This commit is contained in:
Antoine Pilote
2023-07-17 01:49:32 -04:00
parent 0534c0fd81
commit 415f6dd5cd
3 changed files with 8 additions and 4 deletions

View File

@@ -4,7 +4,9 @@ import "Nuake:Math" for Vector3
class Scene {
foreign static GetEntityID(name)
foreign static AddEntity(name)
foreign static AddPrefab(prefabPath)
static GetEntity(name) {
var entId = Scene.GetEntityID(name)
var ent = Entity.new(entId)

View File

@@ -220,7 +220,7 @@ namespace Nuake
std::string FileSystem::GetFileNameFromPath(const std::string& path)
{
const auto split = String::Split(path, '\\');
const auto& split = String::Split(path, '\\');
return String::Split(split[split.size() - 1], '.')[0];
}

View File

@@ -179,12 +179,14 @@ namespace Nuake {
Entity Scene::GetEntity(const std::string& name)
{
std::vector<Entity> allEntities;
auto view = m_Registry.view<TransformComponent, NameComponent>();
const auto& view = m_Registry.view<NameComponent>();
for (auto e : view)
{
auto [transform, namec] = view.get<TransformComponent, NameComponent>(e);
const auto& namec = view.get<NameComponent>(e);
if (namec.Name == name)
{
return Entity{ e, this };
}
}
return Entity();