memory setup
This commit is contained in:
33
src/game/Global.cpp
Normal file
33
src/game/Global.cpp
Normal file
@@ -0,0 +1,33 @@
|
||||
#include "Global.h"
|
||||
#include <cassert>
|
||||
|
||||
namespace
|
||||
{
|
||||
SharedData* SharedInstance = nullptr;
|
||||
Game::GameInstance* GameInst = nullptr;
|
||||
}
|
||||
|
||||
namespace Game
|
||||
{
|
||||
SharedData& GetShared()
|
||||
{
|
||||
assert(SharedInstance != nullptr);
|
||||
return *SharedInstance;
|
||||
}
|
||||
|
||||
void SetShared(SharedData& instance)
|
||||
{
|
||||
SharedInstance = &instance;
|
||||
}
|
||||
|
||||
GameInstance& GetInstance()
|
||||
{
|
||||
assert(GameInst != nullptr);
|
||||
return *GameInst;
|
||||
}
|
||||
|
||||
void SetInstance(Game::GameInstance& instance)
|
||||
{
|
||||
GameInst = &instance;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user