Добавил shared_from_this как основной способ создать умный указатель на "себя". Добавил пример работы с ним

This commit is contained in:
Jiga228
2026-06-28 15:44:58 +07:00
parent 311772cca4
commit ad881a97a9
13 changed files with 77 additions and 47 deletions
+6 -6
View File
@@ -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;
};