Web assembly #6

Merged
Mergul merged 38 commits from WebAssembly into master 2020-04-14 17:44:27 +02:00
3 changed files with 335 additions and 171 deletions
Showing only changes of commit 87e9a31d7f - Show all commits

File diff suppressed because it is too large Load diff

View file

@ -77,9 +77,9 @@ struct System
/************************************************************************************************************************
*Get system name.
*/
export const (char)[] name() nothrow @nogc
export const(char)[] name() nothrow @nogc
{
return cast(const (char)[])m_name;
return cast(const(char)[]) m_name;
}
struct EventCaller
@ -120,10 +120,13 @@ package:
ushort[] m_read_only_components;
ushort[] m_modified_components;
EntityManager.SystemCaller* m_any_system_caller;
EventCaller[] m_event_callers;
//void function(ref EntityManager.CallData data) m_update;
void* m_update; ///workaroud for DMD bug with upper line
void delegate() m_update_delegate;
//void function(void* system_pointer) m_enable;
//void function(void* system_pointer) m_disable;

View file

@ -501,6 +501,20 @@ struct TestSystem2
}
struct ExternalUpdateCallTest
{
int print_count = 3;
void update(TestSystem2.EntitiesData data)
{
if(print_count > 0)
{
print_count--;
printf("ExternalUpdateCallTest %u %u\n", data.test[0].gg, cast(uint)data.length);
}
}
}
extern(C) int main()
{
@ -660,8 +674,6 @@ extern(C) int main()
gEM.registerSystem!TestSystem2(0);
gEM.endRegister();
System* sys = EntityManager.instance.getSystem(TestSystem2.system_id);
//gEM.generateDependencies();
//assert(*(cast(EntityID*)(cast(void*)tmpl.info.first_block+24)) == EntityID(1,1));
@ -799,6 +811,12 @@ extern(C) int main()
gEM.commit();
System* sys = EntityManager.instance.getSystem(TestSystem2.system_id);
ExternalUpdateCallTest external_update_test;
EntityManager.instance.callEntitiesFunction!TestSystem2(&external_update_test.update);
printf("pre end\n");
writeEntityComponents(gEM.getEntity(entity));