From 9b757720395f9b081ba66c4cb966fa9b763aff2d Mon Sep 17 00:00:00 2001 From: Mergul Date: Thu, 10 Apr 2025 13:59:21 +0200 Subject: [PATCH] Add missing export visibility attributes --- source/bubel/ecs/entity.d | 12 ++++++------ source/bubel/ecs/hash_map.d | 2 +- source/bubel/ecs/manager.d | 10 ++++++++++ source/bubel/ecs/system.d | 2 +- 4 files changed, 18 insertions(+), 8 deletions(-) diff --git a/source/bubel/ecs/entity.d b/source/bubel/ecs/entity.d index 9b42c31..76a8a2f 100644 --- a/source/bubel/ecs/entity.d +++ b/source/bubel/ecs/entity.d @@ -44,7 +44,7 @@ struct Entity return cast(T*)getComponent(becsID!T); } - void* getComponent(ushort component_id) const + export void* getComponent(ushort component_id) const { EntityManager.EntitiesBlock* block = gEntityManager.getMetaData(&this); EntityManager.EntityInfo* info = block.type_info; @@ -54,7 +54,7 @@ struct Entity return (cast(void*)block + info.deltas[component_id] + block.entityIndex(&this) * gEntityManager.components[component_id].size); } - bool hasComponent(ushort component_id) const + export bool hasComponent(ushort component_id) const { EntityManager.EntitiesBlock* block = gEntityManager.getMetaData(&this); EntityManager.EntityInfo* info = block.type_info; @@ -62,7 +62,7 @@ struct Entity return true; } - EntityMeta getMeta() const + export EntityMeta getMeta() const { EntityMeta meta; meta.block = gEntityManager.getMetaData(&this); @@ -85,7 +85,7 @@ struct EntityMeta return cast(T*)getComponent(becsID!T); } - void* getComponent(ushort component_id) const + export void* getComponent(ushort component_id) const { const (EntityManager.EntityInfo)* info = block.type_info; @@ -95,7 +95,7 @@ struct EntityMeta return (cast(void*)block + info.deltas[component_id] + index * gEntityManager.components[component_id].size); } - bool hasComponent(ushort component_id) const + export bool hasComponent(ushort component_id) const { const EntityManager.EntityInfo* info = block.type_info; if (component_id >= info.deltas.length || info.deltas[component_id] == 0)return false; @@ -133,7 +133,7 @@ export struct EntityTemplate /************************************************************************************************************************ Get specified component. If component doesn't exist function return null. Returned pointer is valid during EntityTemplate lifetime. */ - void* getComponent(ushort component_id) const nothrow @nogc + export void* getComponent(ushort component_id) const nothrow @nogc { if(component_id >= info.tmpl_deltas.length || info.tmpl_deltas[component_id] == ushort.max)return null; return cast(void*)(entity_data.ptr + info.tmpl_deltas[component_id]); diff --git a/source/bubel/ecs/hash_map.d b/source/bubel/ecs/hash_map.d index 66a0756..7ba6137 100755 --- a/source/bubel/ecs/hash_map.d +++ b/source/bubel/ecs/hash_map.d @@ -28,7 +28,7 @@ export ulong defaultHashFunc(T)(auto ref T t) nothrow @nogc } } -ulong hash(byte[] array) nothrow @nogc +export ulong hash(byte[] array) nothrow @nogc { ulong hash = 0; diff --git a/source/bubel/ecs/manager.d b/source/bubel/ecs/manager.d index d6fae94..0977786 100644 --- a/source/bubel/ecs/manager.d +++ b/source/bubel/ecs/manager.d @@ -3355,6 +3355,16 @@ export struct EntityManager export ~this() nothrow @nogc { } + + export void opAssign(ComponentInfo c) + { + size = c.size; + alignment = c.alignment; + init_data = c.init_data; + destroy_callback = c.destroy_callback; + create_callback = c.create_callback; + } + ///Component size ushort size; ///Component data alignment diff --git a/source/bubel/ecs/system.d b/source/bubel/ecs/system.d index 24098c0..e6defd9 100644 --- a/source/bubel/ecs/system.d +++ b/source/bubel/ecs/system.d @@ -108,7 +108,7 @@ struct System package: ///destory system. Dispose all data - void destroy() nothrow @nogc + export void destroy() nothrow @nogc { import bubel.ecs.std : Mallocator;