Добавил shared_from_this как основной способ создать умный указатель на "себя". Добавил пример работы с ним
This commit is contained in:
@@ -11,10 +11,10 @@ GameInstance* GameFactory(CoreInstance& core) { return new Class(core); }
|
||||
|
||||
class GameInstance
|
||||
{
|
||||
CoreInstance& core;
|
||||
World* world = nullptr;
|
||||
CoreInstance& core_;
|
||||
std::shared_ptr<World> world_;
|
||||
|
||||
std::atomic<bool> is_running = true;
|
||||
std::atomic<bool> is_running_ = true;
|
||||
|
||||
void start();
|
||||
// Stop call from the core
|
||||
@@ -25,10 +25,10 @@ public:
|
||||
|
||||
// Init vulkan
|
||||
GameInstance(CoreInstance& core);
|
||||
virtual ~GameInstance();
|
||||
virtual ~GameInstance() = default;
|
||||
|
||||
World* GetWorld() const { return world; }
|
||||
CoreInstance& GetCore() const { return core; }
|
||||
std::shared_ptr<World> GetWorld() const { return world_; }
|
||||
CoreInstance& GetCore() const { return core_; }
|
||||
|
||||
friend class CoreInstance;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user