35 lines
657 B
C++
35 lines
657 B
C++
#pragma once
|
|
|
|
#include <atomic>
|
|
#include <memory>
|
|
|
|
class CoreInstance;
|
|
class World;
|
|
|
|
#define GENERATE_FACTORY_GAME_INSTANCE(Class) \
|
|
GameInstance* GameFactory(CoreInstance& core) { return new Class(core); }
|
|
|
|
class GameInstance
|
|
{
|
|
CoreInstance& core_;
|
|
std::shared_ptr<World> world_;
|
|
|
|
std::atomic<bool> is_running_ = true;
|
|
|
|
void start();
|
|
// Stop call from the core
|
|
void stop();
|
|
public:
|
|
// Stop call from game
|
|
void quit();
|
|
|
|
// Init vulkan
|
|
GameInstance(CoreInstance& core);
|
|
virtual ~GameInstance() = default;
|
|
|
|
std::shared_ptr<World> GetWorld() const { return world_; }
|
|
CoreInstance& GetCore() const { return core_; }
|
|
|
|
friend class CoreInstance;
|
|
};
|