-added export attribute

This commit is contained in:
Mergul 2019-05-15 08:47:30 +00:00
parent 9220a28f7c
commit cb257a2360
4 changed files with 28 additions and 26 deletions

View file

@ -8,7 +8,8 @@
"license": "BSD",
"sourcePaths" : ["source\/"],
"dflags-posix-ldc": [
"-defaultlib=phobos2-ldc,druntime-ldc"
"-defaultlib=phobos2-ldc,druntime-ldc",
"-fvisibility=hidden"
],
"dflagss": [
"-betterC"

View file

@ -76,7 +76,7 @@ struct EventManager
manager = m;
}
void sendEvent(Ev)(EntityID id, Ev event, uint thread_id = 0) nothrow @nogc
export void sendEvent(Ev)(EntityID id, Ev event, uint thread_id = 0) nothrow @nogc
{
uint block_id = current_index+thread_id;

View file

@ -23,15 +23,15 @@ import ecs.vector;
import ecs.events;
import ecs.traits;
alias gEM = EntityManager.instance;
alias gEntityManager = EntityManager.instance;
alias gEventManager = EntityManager.instance;
export alias gEM = EntityManager.instance;
export alias gEntityManager = EntityManager.instance;
export alias gEventManager = EntityManager.instance;
alias SerializeVector = ecs.vector.Vector!ubyte;
/************************************************************************************************************************
*Entity manager is responsible for everything.
*/
class EntityManager
export class EntityManager
{
export static void initialize(uint threads_count)
{
@ -62,7 +62,7 @@ class EntityManager
/************************************************************************************************************************
*Begin registering process. Every register function should be called between beginRegister() and endRegister().
*/
void beginRegister() nothrow @nogc
export void beginRegister() nothrow @nogc
{
assert(!register_state, "beginRegister() can't be called twice before endRegister();");
register_state = true;
@ -80,7 +80,7 @@ class EntityManager
/************************************************************************************************************************
*End registering process. Every register function should be called between beginRegister() and endRegister().
*/
void endRegister()
export void endRegister()
{
assert(register_state, "beginRegister() should be called before endRegister();");
register_state = false;
@ -699,7 +699,7 @@ class EntityManager
/************************************************************************************************************************
*Return system ECS api by id
*/
System* getSystem(ushort id) nothrow @nogc
export System* getSystem(ushort id) nothrow @nogc
{
return &systems[id];
}
@ -712,7 +712,7 @@ class EntityManager
return cast(Sys*) systems[Sys.system_id].m_system_pointer;
}
ushort registerPass(const(char)[] name)
export ushort registerPass(const(char)[] name)
{
UpdatePass* pass = Mallocator.instance.make!UpdatePass;
pass.name = Mallocator.instance.makeArray(name);
@ -815,7 +815,7 @@ class EntityManager
/************************************************************************************************************************
*Same as "void update(int pass = 0)" but use pass name instead of id.
*/
void update(const(char)[] pass_name) nothrow @nogc
export void update(const(char)[] pass_name) nothrow @nogc
{
ushort pass = passes_map.get(pass_name, ushort.max);
assert(pass != ushort.max);
@ -846,14 +846,14 @@ class EntityManager
/************************************************************************************************************************
*Same as "void updateMT(int pass = 0)" but use pass name instead of id.
*/
void updateMT(const(char)[] pass_name) nothrow @nogc
export void updateMT(const(char)[] pass_name) nothrow @nogc
{
ushort pass = passes_map.get(pass_name, ushort.max);
assert(pass != ushort.max);
updateMT(pass);
}
void updateMT(ushort pass = 0) nothrow @nogc
export void updateMT(ushort pass = 0) nothrow @nogc
{
assert(!register_state);
assert(pass < passes.length);
@ -982,7 +982,7 @@ class EntityManager
}
}
void setJobDispachFunc(void delegate(JobGroup) func) nothrow @nogc
export void setJobDispachFunc(void delegate(JobGroup) func) nothrow @nogc
{
m_dispatch_jobs = func;
}
@ -1123,7 +1123,7 @@ class EntityManager
return info;
}
void generateListeners(EntityInfo* info)
private void generateListeners(EntityInfo* info)
{
if (info.add_listeners)
{
@ -2053,7 +2053,7 @@ class EntityManager
}
}
void updateEvents() nothrow @nogc
private void updateEvents() nothrow @nogc
{
bool empty = true;
while (1)
@ -2164,8 +2164,7 @@ class EntityManager
event_manager.sendEvent(id, event, thread_id);
}
/*private */
void generateDependencies() nothrow @nogc
private void generateDependencies() nothrow @nogc
{
foreach (pass_id, pass; passes)
{
@ -2398,7 +2397,7 @@ class EntityManager
struct EntitiesBlock
{
///return distance (in bytes) from begin of block to data
uint dataDelta() nothrow @nogc
export uint dataDelta() nothrow @nogc
{
ushort dif = EntitiesBlock.sizeof;
alignNum(dif, type_info.alignment);
@ -2438,7 +2437,7 @@ class EntityManager
*/
struct CallData
{
void update() nothrow @nogc
export void update() nothrow @nogc
{
(cast(SytemFuncType) system.m_update)(this);
}
@ -2472,7 +2471,7 @@ class EntityManager
{
CallData[] callers;
void execute() nothrow @nogc
export void execute() nothrow @nogc
{
EntityManager.instance.getThreadID();
foreach (ref caller; callers)
@ -2519,15 +2518,17 @@ class EntityManager
Vector!(EntitiesBlock*) blocks_to_update;
}
struct UpdatePass
export struct UpdatePass
{
~this() nothrow @nogc
export ~this() nothrow @nogc
{
assert(name);
if (name)
Mallocator.instance.dispose(name);
}
export size_t __xtoHash();
char[] name;
Vector!(SystemCaller*) system_callers;
}
@ -2620,7 +2621,7 @@ class EntityManager
}
}
__gshared EntityManager instance = null;
export __gshared EntityManager instance = null;
}
/*

View file

@ -11,8 +11,8 @@ export @nogc @safe nothrow pure size_t nextPow2(size_t num) {
return 1 << bsr(num) + 1;
}
__gshared size_t gVectorsCreated = 0;
__gshared size_t gVectorsDestroyed = 0;
export __gshared size_t gVectorsCreated = 0;
export __gshared size_t gVectorsDestroyed = 0;
struct Vector(T) {
T[] array;