Начинаю добавлять управление камерой. (Сейчас только её позиция)
This commit is contained in:
@@ -50,6 +50,7 @@ public:
|
||||
object->SetActorLocate(loc);
|
||||
object->SetActorRotate(rot);
|
||||
static_cast<Actor*>(object)->world_ = this;
|
||||
static_cast<Actor*>(object)->name_ = name;
|
||||
actors_map.try_emplace(name, object);
|
||||
return object;
|
||||
}
|
||||
@@ -77,7 +78,11 @@ public:
|
||||
template<class T>
|
||||
std::weak_ptr<T> GetActorByID(const std::string& id)
|
||||
{
|
||||
return actors_map[id];
|
||||
auto it = actors_map.find(id);
|
||||
if (it == actors_map.end() || it->second == nullptr)
|
||||
return {};
|
||||
|
||||
return std::static_pointer_cast<T>(it->second);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user