-changed README
-license changed to BSD (maybe temporary) -added configurations to dub.json -initial ECS implementation (WIP): -Manager, System, Entity, Component -registering components -registering systems -calling update
This commit is contained in:
parent
8285bde71d
commit
6217aec6be
10 changed files with 265 additions and 11 deletions
69
tests/tests.d
Normal file
69
tests/tests.d
Normal file
|
|
@ -0,0 +1,69 @@
|
|||
module tests.tests;
|
||||
|
||||
import ecs.manager;
|
||||
import ecs.events;
|
||||
import ecs.system;
|
||||
import ecs.entity;
|
||||
|
||||
int main()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
unittest
|
||||
{
|
||||
|
||||
alias SerializeVector = ubyte[];
|
||||
|
||||
struct TestComp
|
||||
{
|
||||
__gshared static int component_id;
|
||||
int a;
|
||||
ulong b;
|
||||
|
||||
static void serializeComponent(ref TestComp comp, SerializeVector output)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
static void deserializeComponent(ref TestComp comp, ubyte[] data)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
struct TestSystem
|
||||
{
|
||||
|
||||
void initialize(ref TestComp comp)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void update()//ref TestComp comp)
|
||||
{
|
||||
//comp.a+=1000;
|
||||
//comp.b+=2000;
|
||||
import std.stdio;
|
||||
writeln("Jakis tekst!");
|
||||
}
|
||||
|
||||
void handleEvent(Event event, ref TestComp comp)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
EntityManager.initialize();
|
||||
assert(gEM !is null);
|
||||
|
||||
|
||||
gEM.registerComponent!TestComp;
|
||||
|
||||
uint[1] ids = [0];
|
||||
EntityTemplate* tmpl = gEM.allocateTemplate(ids);
|
||||
|
||||
gEM.registerSystem!TestSystem(0);
|
||||
|
||||
gEM.update();
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue