@@ -333,6 +333,37 @@ typedef struct ecsact_execution_options {
333
333
* Sequential list of actions to be executed.
334
334
*/
335
335
ecsact_action * actions ;
336
+
337
+ /**
338
+ * Length of entities to be created.
339
+ */
340
+ int create_entities_length ;
341
+
342
+ /**
343
+ * Sequential list of component lengths for each entity in
344
+ * `create_entities_components`.
345
+ */
346
+ int * create_entities_components_length ;
347
+
348
+ /**
349
+ * A sequential 2D list that represents a set of entities with a list of
350
+ * components. Entity length is determined by `create_entities_length`. The
351
+ * length of components for each entity is determined by
352
+ * `create_entities_components_length`.
353
+ */
354
+ ecsact_component * * create_entities_components ;
355
+
356
+ /**
357
+ * Length of `destroy_entities` sequential list.
358
+ */
359
+ int destroy_entities_length ;
360
+
361
+ /**
362
+ * A sequentual list of entity IDs that will be destroyed along with its
363
+ * components. Length is determined by `destroy_entities_length`.
364
+ */
365
+ ecsact_entity_id * destroy_entities ;
366
+
336
367
} ecsact_execution_options ;
337
368
338
369
typedef enum {
@@ -363,6 +394,24 @@ typedef enum {
363
394
* when at the end of the execution call the component is removed.
364
395
*/
365
396
ECSACT_EVENT_REMOVE_COMPONENT = 2 ,
397
+
398
+ /**
399
+ * Create entity - Entity has been created during execution.
400
+ *
401
+ * Happens on entity creation and before any `INIT_COMPONENT`
402
+ * events. It will also be triggered by any generated entities. Returns the
403
+ * entity ID associated with the created entity
404
+ */
405
+ ECSACT_EVENT_CREATE_ENTITY = 3 ,
406
+
407
+ /**
408
+ * Destroy entity - Entity has been destroyed during execution.
409
+ *
410
+ * Invoked when an entity is destroyed. Any components associated with the
411
+ * entity will also be destroyed. Returns the entity ID associated with the
412
+ * destroyed entity
413
+ */
414
+ ECSACT_EVENT_DESTROY_ENTITY = 4 ,
366
415
} ecsact_event ;
367
416
368
417
/**
@@ -376,12 +425,15 @@ typedef void (*ecsact_component_event_callback)( //
376
425
void * callback_user_data
377
426
);
378
427
428
+ typedef void (* ecsact_entity_event_callback
429
+ )(ecsact_event event , ecsact_entity_id entity_id , void * callback_user_data );
430
+
379
431
/**
380
432
* Holds event handler callbacks and their user data
381
433
*/
382
434
typedef struct ecsact_execution_events_collector {
383
435
/**
384
- * invoked after system executions are finished for every component that is
436
+ * Invoked after system executions are finished for every component that is
385
437
* new. The component_data is the last value given for the component, not the
386
438
* first. Invocation happens in the calling thread. `event` will always be
387
439
* `ECSACT_EVENT_INIT_COMPONENT`
@@ -394,7 +446,7 @@ typedef struct ecsact_execution_events_collector {
394
446
void * init_callback_user_data ;
395
447
396
448
/**
397
- * invoked after system executions are finished for every changed component.
449
+ * Invoked after system executions are finished for every changed component.
398
450
* Invocation happens in the calling thread. `event` will always be
399
451
* `ECSACT_EVENT_UPDATE_COMPONENT`
400
452
*/
@@ -406,8 +458,8 @@ typedef struct ecsact_execution_events_collector {
406
458
void * update_callback_user_data ;
407
459
408
460
/**
409
- * invoked after system executions are finished for every removed component.
410
- * Invocation happens in the calling thread. `event` will will always be
461
+ * Invoked after system executions are finished for every removed component.
462
+ * Invocation happens in the calling thread. `event` will always be
411
463
* `ECSACT_EVENT_REMOVE_COMPONENT`.
412
464
*/
413
465
ecsact_component_event_callback remove_callback ;
@@ -416,6 +468,31 @@ typedef struct ecsact_execution_events_collector {
416
468
* `callback_user_data` passed to `remove_callback`
417
469
*/
418
470
void * remove_callback_user_data ;
471
+
472
+ /**
473
+ * Invoked after system executions are finished for every created entity.
474
+ * Invocation happens in the calling thread. `event` will will always be
475
+ * `ECSACT_EVENT_CREATE_ENTITY`.
476
+ */
477
+ ecsact_entity_event_callback entity_created_callback ;
478
+
479
+ /**
480
+ * `callback_user_data` passed to `entity_created_callback`
481
+ */
482
+ void * entity_created_callback_user_data ;
483
+
484
+ /**
485
+ * Invoked after system executions are finished for every removed component.
486
+ * Invocation happens in the calling thread. `event` will will always be
487
+ * `ECSACT_EVENT_DESTROY_COMPONENT`.
488
+ */
489
+ ecsact_entity_event_callback entity_destroyed_callback ;
490
+
491
+ /**
492
+ * `callback_user_data` passed to `entity_destroyed_callback`
493
+ */
494
+ void * entity_destroyed_callback_user_data ;
495
+
419
496
} ecsact_execution_events_collector ;
420
497
421
498
/**
0 commit comments