mirror of
https://github.com/antopilo/Nuake.git
synced 2026-09-04 11:35:06 +03:00
Added Wren API endpoints + random cleanup
This commit is contained in:
@@ -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)
|
||||
|
||||
@@ -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];
|
||||
}
|
||||
|
||||
|
||||
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user