Improving entity manager and entity support for a simpler version, made some cleanup on the road to support serialization of world
This commit is contained in:
@@ -0,0 +1,47 @@
|
||||
#pragma once
|
||||
|
||||
#include <Core/Common/CoreTypes.h>
|
||||
#include <Core/Common/NonNullPtr.h>
|
||||
#include <Core/Common/String.h>
|
||||
#include <Core/Container/Vector.h>
|
||||
#include <Core/Memory/MemoryArena.h>
|
||||
#include <Entity/Entity.h>
|
||||
|
||||
struct archive;
|
||||
struct EntityManager;
|
||||
|
||||
#pragma pack(push, 1)
|
||||
struct WorldFileHeader
|
||||
{
|
||||
uint32 Magic = 0x444C574A; // 'JWLD' in little-endian
|
||||
uint32 Version = 1;
|
||||
};
|
||||
|
||||
struct WorldEntityDiskRecord
|
||||
{
|
||||
float X = 0.0f;
|
||||
float Y = 0.0f;
|
||||
float Z = 0.0f;
|
||||
};
|
||||
#pragma pack(pop)
|
||||
|
||||
constexpr uint32 kWorldMagic = 0x444C574A; // 'JWLD'
|
||||
constexpr uint32 kWorldVersion = 1;
|
||||
|
||||
struct World
|
||||
{
|
||||
Arena* WorldArena = nullptr;
|
||||
EntityManager* EntityManager = nullptr;
|
||||
};
|
||||
|
||||
void InitWorld(NonNullPtr<World> world, NonNullPtr<Arena> arena);
|
||||
void ShutdownWorld(NonNullPtr<World> world);
|
||||
|
||||
void AddToWorld(NonNullPtr<World> world, NonNullPtr<Entity> entity);
|
||||
void RemoveWorldEntity(World& world, size_t index);
|
||||
|
||||
void Serialize(archive& data, World& world, String filename);
|
||||
|
||||
#if JULIET_EDITOR
|
||||
void RenderWorldEditorUI(World& world);
|
||||
#endif
|
||||
Reference in New Issue
Block a user