-fully working betterC for windows

*replaced array[..] = array[ .. ] sclice copy with mempcy
 *added own std library (allocator, alloca, Mutex)
 *changed tamplates for collecting components for systems
-fixed issue with multiple optional components registering for system
This commit is contained in:
Mergul 2019-10-10 20:56:44 +02:00
parent ed99807871
commit 41f1c6474b
14 changed files with 722 additions and 868 deletions

View file

@ -1,7 +1,9 @@
module ecs.simple_vector;
/*
import std.experimental.allocator;
import std.experimental.allocator.mallocator;
import std.experimental.allocator.mallocator;*/
import ecs.std;
import core.stdc.string;
@ -14,8 +16,8 @@ struct SimpleVector
{
while(used >= data.length)
{
if(data is null)data = Mallocator.instance.makeArray!ubyte(1024);
else Mallocator.instance.expandArray(data,data.length);
if(data is null)data = Mallocator.makeArray!ubyte(1024);
else data = Mallocator.expandArray(data,data.length);
}
data[used++] = el;
}
@ -24,8 +26,8 @@ struct SimpleVector
{
while(used + el.length >= data.length)
{
if(data is null)data = Mallocator.instance.makeArray!ubyte(1024);
else Mallocator.instance.expandArray(data,data.length);
if(data is null)data = Mallocator.makeArray!ubyte(1024);
else data = Mallocator.expandArray(data,data.length);
}
memcpy(data.ptr + used, el.ptr, el.length);
used += el.length;