entity system!
This commit is contained in:
@@ -1,7 +1,9 @@
|
||||
#include "Setup.h"
|
||||
#include "Log.h"
|
||||
#include "bx/timer.h"
|
||||
#include "rendering/Rendering.h"
|
||||
#include "Global.h"
|
||||
#include "Instance.h"
|
||||
|
||||
namespace Game
|
||||
{
|
||||
@@ -20,7 +22,22 @@ namespace Game
|
||||
{
|
||||
Log("Game Setup Start!");
|
||||
|
||||
GameInstance& instance = *reinterpret_cast<GameInstance*>(&shared.Game.PermanentStorage);
|
||||
if (shared.Game.PermanentStorage == nullptr)
|
||||
{
|
||||
Log("Game memory not initialized!!");
|
||||
return;
|
||||
}
|
||||
if (shared.Game.EntityStorage == nullptr)
|
||||
{
|
||||
Log("Entity memory not initialized!");
|
||||
return;
|
||||
}
|
||||
if (shared.Game.PermanentStorageSize < sizeof(GameInstance))
|
||||
{
|
||||
Log("Game memory too small! %u < %u", shared.Game.PermanentStorageSize, sizeof(GameInstance));
|
||||
return;
|
||||
}
|
||||
GameInstance& instance = *reinterpret_cast<GameInstance*>(shared.Game.PermanentStorage);
|
||||
if (sizeof(GameInstance) != instance.Size)
|
||||
{
|
||||
Log("Game instance size changed, resetting!");
|
||||
@@ -29,11 +46,14 @@ namespace Game
|
||||
SetShared(shared);
|
||||
SetInstance(instance);
|
||||
SetupInstance.Rendering.Setup();
|
||||
instance.GameLevel.Setup(shared.Game);
|
||||
instance.IsInitialized = true;
|
||||
}
|
||||
|
||||
void Update()
|
||||
{
|
||||
++GetInstance().FrameCounter;
|
||||
GetInstance().Now = (bx::getHPCounter() - GetInstance().StartTime) / (double)(bx::getHPFrequency());
|
||||
SetupInstance.Rendering.Update();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user