@@ -400,21 +400,15 @@ TEST(AsyncRef, ReceiveMultipleEntities) {
400
400
401
401
auto connect_req_id = ecsact_async_connect (" good?tick_rate=25" );
402
402
403
- auto entity_options = ecsact_execution_options {};
403
+ auto options = ecsact::core::execution_options {};
404
404
405
- entity_options.create_entities_components = {nullptr };
406
- entity_options.create_entities_length = 0 ;
407
- entity_options.create_entities_components_length = nullptr ;
405
+ options.create_entity ();
408
406
409
407
for (int i = 0 ; i < 10 ; i++) {
410
- ecsact_async_enqueue_execution_options (entity_options );
408
+ ecsact_async_enqueue_execution_options (options. c () );
411
409
}
412
410
413
- int counter = 0 ;
414
- ecsact_entity_id entity;
415
-
416
411
struct entity_cb_info {
417
- ecsact_entity_id& entity;
418
412
std::array<int , 10 > entity_request_ids;
419
413
int & counter;
420
414
};
@@ -431,17 +425,14 @@ TEST(AsyncRef, ReceiveMultipleEntities) {
431
425
entity_info.counter ++;
432
426
};
433
427
434
- entity_cb_info entity_info{
435
- .entity = entity,
436
- .entity_request_ids = {},
437
- .counter = counter};
428
+ int counter = 0 ;
429
+
430
+ entity_cb_info entity_info{.entity_request_ids = {}, .counter = counter};
438
431
439
432
auto evc = ecsact_execution_events_collector{};
440
433
evc.entity_created_callback = entity_cb;
441
434
evc.entity_created_callback_user_data = &entity_info;
442
435
443
- ecsact_async_enqueue_execution_options (entity_options);
444
-
445
436
auto start_tick = ecsact_async_get_current_tick ();
446
437
while (counter < 10 ) {
447
438
ecsact_async_flush_events (&evc, nullptr );
@@ -488,31 +479,13 @@ TEST(AsyncRef, TryAction) {
488
479
489
480
async_test::ComponentUpdate my_update_component{.value_to_update = 1 };
490
481
491
- auto needed_component = ecsact_component{
492
- .component_id = async_test::NeededComponent::id,
493
- .component_data = &my_needed_component,
494
- };
495
- auto update_component = ecsact_component{
496
- .component_id = async_test::ComponentUpdate::id,
497
- .component_data = &my_update_component,
498
- };
499
-
500
- // Add components to an array
501
- std::array<ecsact_component*, 2 > add_components{
502
- &needed_component,
503
- &update_component,
504
- };
505
-
506
- int component_length = 2 ;
507
- int * component_length_ptr = &component_length;
508
-
509
- auto options = ecsact_execution_options{};
482
+ auto options = ecsact::core::execution_options{};
510
483
511
- options.create_entities_components = {add_components. data ()};
512
- options. create_entities_length = 2 ;
513
- options. create_entities_components_length = component_length_ptr ;
484
+ options.create_entity ()
485
+ . add_component (&my_needed_component)
486
+ . add_component (&my_update_component) ;
514
487
515
- ecsact_async_enqueue_execution_options (options);
488
+ ecsact_async_enqueue_execution_options (options. c () );
516
489
517
490
auto evc = ecsact_execution_events_collector{};
518
491
evc.entity_created_callback = entity_cb;
@@ -526,6 +499,8 @@ TEST(AsyncRef, TryAction) {
526
499
ASSERT_LT (tick_diff, 10 );
527
500
}
528
501
502
+ options.clear ();
503
+
529
504
async_test::TryEntity my_try_entity;
530
505
531
506
my_try_entity.my_entity = cb_info.entity ;
@@ -542,20 +517,14 @@ TEST(AsyncRef, TryAction) {
542
517
}
543
518
);
544
519
545
- std::vector<ecsact_action> actions{};
546
-
547
520
ecsact_action my_action{
548
521
.action_id = async_test::TryEntity::id,
549
522
.action_data = &my_try_entity,
550
523
};
551
524
552
- actions.push_back (my_action);
553
- options = {};
525
+ options.push_action (my_action);
554
526
555
- options.actions = actions.data ();
556
- options.actions_length = actions.size ();
557
-
558
- ecsact_async_enqueue_execution_options (options);
527
+ ecsact_async_enqueue_execution_options (options.c ());
559
528
560
529
start_tick = ecsact_async_get_current_tick ();
561
530
while (reached_system != true ) {
0 commit comments