Added a basic MemoryArena.
Added one scratch, one engine and one game arena. Converted the game alloc to arena + the display stuff. WIP Made using Antigravity+gemini
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
#include <concepts>
|
||||
#include <Core/Common/CoreUtils.h>
|
||||
#include <Core/Memory/Allocator.h>
|
||||
#include <Core/Memory/MemoryArena.h>
|
||||
#include <Engine/Class.h>
|
||||
#include <Entity/EntityManager.h>
|
||||
#include <type_traits>
|
||||
@@ -17,6 +18,8 @@
|
||||
constexpr Juliet::Class entityKind##entity(#entity, sizeof(#entity) / sizeof(char)); \
|
||||
const Juliet::Class* entity::Kind = &entityKind##entity;
|
||||
|
||||
|
||||
|
||||
namespace Game
|
||||
{
|
||||
using DerivedType = void*;
|
||||
@@ -46,8 +49,9 @@ namespace Game
|
||||
requires EntityConcept<EntityType>
|
||||
EntityType* MakeEntity(EntityManager& manager, float x, float y)
|
||||
{
|
||||
EntityType* result = static_cast<EntityType*>(Juliet::Calloc(1, sizeof(EntityType)));
|
||||
Entity* base = result->Base = static_cast<Entity*>(Juliet::Calloc(1, sizeof(Entity)));
|
||||
auto* arena = Juliet::GetGameArena();
|
||||
EntityType* result = Juliet::ArenaPushType<EntityType>(arena);
|
||||
Entity* base = result->Base = Juliet::ArenaPushType<Entity>(arena);
|
||||
base->X = x;
|
||||
base->Y = y;
|
||||
base->Derived = result;
|
||||
|
||||
Reference in New Issue
Block a user