@@ -517,3 +517,30 @@ test "zflecs.struct-dtor-hook" {
517
517
// commented out since the cleanup is never called to free the ArrayList
518
518
// memory.
519
519
}
520
+ fn module (world : * ecs.world_t ) callconv (.C ) void {
521
+ var desc = ecs.component_desc_t { .entity = 0 , .type = .{ .size = 0 , .alignment = 0 } };
522
+ _ = ecs .module_init (world , "SimpleModule" , & desc );
523
+
524
+ ecs .COMPONENT (world , Position );
525
+ ecs .COMPONENT (world , Velocity );
526
+ }
527
+ test "zflecs-module" {
528
+ const world = ecs .init ();
529
+ defer _ = ecs .fini (world );
530
+
531
+ const module_id = ecs .import_c (world , module , "SimpleModule" );
532
+
533
+ try expect (module_id != 0 );
534
+
535
+ _ = ecs .ADD_SYSTEM (world , "move system" , ecs .OnUpdate , move_system );
536
+
537
+ const bob = ecs .new_entity (world , "Bob" );
538
+ _ = ecs .set (world , bob , Position , .{ .x = 0 , .y = 0 });
539
+ _ = ecs .set (world , bob , Velocity , .{ .x = 1 , .y = 2 });
540
+
541
+ _ = ecs .progress (world , 0 );
542
+ _ = ecs .progress (world , 0 );
543
+
544
+ const p = ecs .get (world , bob , Position ).? ;
545
+ print ("Bob's position is ({d}, {d})\n " , .{ p .x , p .y });
546
+ }
0 commit comments