diff --git a/cpp/src/component.cpp b/cpp/src/component.cpp index 01e2b55..758197c 100644 --- a/cpp/src/component.cpp +++ b/cpp/src/component.cpp @@ -20,8 +20,6 @@ using namespace godot; -GFComponent::GFComponent() { -} GFComponent::~GFComponent() { } @@ -36,10 +34,7 @@ Ref GFComponent::from_id(ecs_entity_t comp, ecs_entity_t entity, GF " Entity ", world->id_to_text(comp), " is not a component" ); } - Ref comp_ref = Ref(memnew(GFComponent)); - comp_ref->source_entity_id = entity; - comp_ref->set_id(comp); - comp_ref->set_world(world); + Ref comp_ref = memnew(GFComponent(entity, comp, world)); return setup_template(comp_ref); } @@ -51,10 +46,7 @@ Ref GFComponent::from_id_no_source(ecs_entity_t comp, GFWorld* worl " Entity ", world->id_to_text(comp), " is not a component" ); } - Ref comp_ref = Ref(memnew(GFComponent)); - comp_ref->source_entity_id = 0; - comp_ref->set_id(comp); - comp_ref->set_world(world); + Ref comp_ref = Ref(memnew(GFComponent(0, comp, world))); comp_ref->update_script(); return comp_ref; } @@ -373,10 +365,6 @@ void GFComponent::set_source_id(ecs_entity_t id) { source_entity_id = id; } -Ref GFComponent::new_internal() { - return Ref(memnew(GFComponent)); -} - void GFComponent::_bind_methods() { GDVIRTUAL_BIND(_build, "b"); godot::ClassDB::bind_method(D_METHOD("_register_internal"), &GFComponent::_register_internal); @@ -393,6 +381,4 @@ void GFComponent::_bind_methods() { godot::ClassDB::bind_method(D_METHOD("get_data_alignment"), &GFComponent::get_data_alignment); godot::ClassDB::bind_method(D_METHOD("is_alive"), &GFComponent::is_alive); godot::ClassDB::bind_method(D_METHOD("_to_string"), &GFComponent::to_string); - - godot::ClassDB::bind_static_method(get_class_static(), D_METHOD("_new_internal"), &GFComponent::new_internal); } diff --git a/cpp/src/component.h b/cpp/src/component.h index da79f99..88dae70 100644 --- a/cpp/src/component.h +++ b/cpp/src/component.h @@ -18,16 +18,18 @@ namespace godot { GDCLASS(GFComponent, GFRegisterableEntity) public: - GFComponent(); GFComponent(ecs_entity_t component, GFWorld* world): - GFRegisterableEntity(component, world) { - update_script(); - } + GFRegisterableEntity(component, world), + source_entity_id(0) + {} GFComponent(ecs_entity_t entity, ecs_entity_t component, GFWorld* world): source_entity_id(entity), - GFRegisterableEntity(component, world) { - update_script(); - } + GFRegisterableEntity(component, world) + {} + GFComponent(): + source_entity_id(0), + GFRegisterableEntity(0, GFWorld::singleton()) + {} ~GFComponent(); // -------------------------------------- @@ -63,7 +65,6 @@ namespace godot { static const EcsStruct* get_struct_ptr(GFWorld*, ecs_entity_t); void set_source_id(ecs_entity_t id); - static Ref new_internal(); protected: static void _bind_methods(); diff --git a/cpp/src/component_builder.h b/cpp/src/component_builder.h index a225246..f077e1a 100644 --- a/cpp/src/component_builder.h +++ b/cpp/src/component_builder.h @@ -16,7 +16,14 @@ namespace godot { GDCLASS(GFComponentBuilder, RefCounted) public: - GFComponentBuilder(GFWorld* world): world(world) {} + GFComponentBuilder(GFWorld* world): + component_desc({0}), + struct_desc({0}), + name(""), + member_names(Array()), + world(world), + built(false) + {} GFComponentBuilder(): GFComponentBuilder(GFWorld::singleton()) {} diff --git a/cpp/src/doc_classes/GFWorld.xml b/cpp/src/doc_classes/GFWorld.xml index ec6dfde..e58b776 100644 --- a/cpp/src/doc_classes/GFWorld.xml +++ b/cpp/src/doc_classes/GFWorld.xml @@ -1,5 +1,6 @@ - + An entity component system world. @@ -51,7 +52,6 @@ [/codeblock] - diff --git a/cpp/src/entity.h b/cpp/src/entity.h index 0522fc1..12ad883 100644 --- a/cpp/src/entity.h +++ b/cpp/src/entity.h @@ -28,7 +28,10 @@ namespace godot { // New entity in specific world GFEntity(GFWorld* world) ; // Reference an entity - GFEntity(ecs_entity_t id_, GFWorld* world_): id(id_), world_instance_id(world_->get_instance_id()) {} + GFEntity(ecs_entity_t id_, GFWorld* world_): + id(id_), + world_instance_id(world_->get_instance_id()) + {} // Copy an entity reference GFEntity(GFEntity& ett): GFEntity(ett.get_id(), ett.get_world()) {} ~GFEntity(); diff --git a/cpp/src/module.cpp b/cpp/src/module.cpp index 2ee3693..2912fcf 100644 --- a/cpp/src/module.cpp +++ b/cpp/src/module.cpp @@ -129,9 +129,6 @@ void GFModule::_register_user() { GFRegisterableEntity::_register_user(); } -Ref GFModule::new_internal() { - return Ref(memnew(GFModule)); -} void GFModule::_bind_methods() { godot::ClassDB::bind_static_method(get_class_static(), D_METHOD("new_in_world", "world"), &GFModule::new_named_in_world); @@ -140,5 +137,4 @@ void GFModule::_bind_methods() { godot::ClassDB::bind_static_method(get_class_static(), D_METHOD("from_id", "module_id", "world"), &GFModule::from_id, nullptr); godot::ClassDB::bind_method(D_METHOD("_register_internal"), &GFModule::_register_internal); godot::ClassDB::bind_method(D_METHOD("_register_user"), &GFModule::_register_user); - godot::ClassDB::bind_static_method(get_class_static(), D_METHOD("_new_internal"), GFModule::new_internal); } diff --git a/cpp/src/module.h b/cpp/src/module.h index 6369c41..43b09d1 100644 --- a/cpp/src/module.h +++ b/cpp/src/module.h @@ -54,8 +54,6 @@ namespace godot { static Ref from(Variant module, GFWorld*); static Ref from_id(ecs_entity_t, GFWorld*); - static Ref new_internal(); - // -------------------------------------- // --- Unexposed // -------------------------------------- diff --git a/cpp/src/observer_builder.h b/cpp/src/observer_builder.h index 23f6d47..07d2fd9 100644 --- a/cpp/src/observer_builder.h +++ b/cpp/src/observer_builder.h @@ -16,8 +16,13 @@ namespace godot { GDCLASS(GFObserverBuilder, GFQuerylikeBuilder) public: - GFObserverBuilder(GFWorld* world): GFQuerylikeBuilder(world) {} - GFObserverBuilder(): GFObserverBuilder(GFWorld::singleton()) {} + GFObserverBuilder(GFWorld* world): + GFQuerylikeBuilder(world), + events(0) + {} + GFObserverBuilder(): + GFObserverBuilder(GFWorld::singleton()) + {} ~GFObserverBuilder(); // ************************************** diff --git a/cpp/src/pair.cpp b/cpp/src/pair.cpp index 15ea071..fdc591e 100644 --- a/cpp/src/pair.cpp +++ b/cpp/src/pair.cpp @@ -12,8 +12,6 @@ using namespace godot; -GFPair::GFPair() { -} GFPair::~GFPair() { } diff --git a/cpp/src/pair.h b/cpp/src/pair.h index 2e7f91c..738230c 100644 --- a/cpp/src/pair.h +++ b/cpp/src/pair.h @@ -16,13 +16,15 @@ namespace godot { GDCLASS(GFPair, GFEntity) public: - GFPair(); GFPair(ecs_entity_t first, ecs_entity_t second, GFWorld* world): GFEntity(ecs_make_pair(first, second), world) - {} + {} GFPair(ecs_entity_t pair_id, GFWorld* world): GFEntity(pair_id, world) - {} + {} + GFPair(): + GFPair(0, nullptr) + {} ~GFPair(); // -------------------------------------- diff --git a/cpp/src/query.cpp b/cpp/src/query.cpp index 88ece69..8d6fb13 100644 --- a/cpp/src/query.cpp +++ b/cpp/src/query.cpp @@ -9,9 +9,6 @@ using namespace godot; -GFQuery::GFQuery() { - -} GFQuery::~GFQuery() { ecs_query_fini(query); } diff --git a/cpp/src/query.h b/cpp/src/query.h index 26cd565..03a2069 100644 --- a/cpp/src/query.h +++ b/cpp/src/query.h @@ -14,8 +14,13 @@ namespace godot { GDCLASS(GFQuery, RefCounted) public: - GFQuery(); - GFQuery(GFWorld* world, ecs_query_t* query): world(world), query(query) {} + GFQuery(GFWorld* world, ecs_query_t* query): + world(world), + query(query) + {} + GFQuery(): + GFQuery(nullptr, nullptr) + {} ~GFQuery(); // -------------------------------------- diff --git a/cpp/src/query_builder.h b/cpp/src/query_builder.h index e3c26d4..6181b3c 100644 --- a/cpp/src/query_builder.h +++ b/cpp/src/query_builder.h @@ -18,8 +18,12 @@ namespace godot { GDCLASS(GFQueryBuilder, GFQuerylikeBuilder) public: - GFQueryBuilder(GFWorld* world): GFQuerylikeBuilder(world) {} - GFQueryBuilder(): GFQueryBuilder(GFWorld::singleton()) {} + GFQueryBuilder(GFWorld* world): + GFQuerylikeBuilder(world) + {} + GFQueryBuilder(): + GFQueryBuilder(GFWorld::singleton()) + {} ~GFQueryBuilder(); // ************************************** diff --git a/cpp/src/query_iterator.cpp b/cpp/src/query_iterator.cpp index 8d509bb..1c82fc9 100644 --- a/cpp/src/query_iterator.cpp +++ b/cpp/src/query_iterator.cpp @@ -11,9 +11,6 @@ using namespace godot; -GFQueryIterator::GFQueryIterator() { -} - GFQueryIterator::~GFQueryIterator() { if (!is_done()) { ecs_iter_fini(&iterator); diff --git a/cpp/src/query_iterator.h b/cpp/src/query_iterator.h index 3319a04..8d89a73 100644 --- a/cpp/src/query_iterator.h +++ b/cpp/src/query_iterator.h @@ -12,11 +12,13 @@ namespace godot { GDCLASS(GFQueryIterator, RefCounted) public: - GFQueryIterator(); + GFQueryIterator(): + GFQueryIterator(nullptr, {0}) + {} GFQueryIterator(Ref query, ecs_iter_t iterator): query(query), iterator(iterator) - {} + {} ~GFQueryIterator(); // -------------------------------------- diff --git a/cpp/src/querylike_builder.cpp b/cpp/src/querylike_builder.cpp index 797f7d1..abe47d4 100644 --- a/cpp/src/querylike_builder.cpp +++ b/cpp/src/querylike_builder.cpp @@ -3,7 +3,6 @@ #include "querylike_builder.h" #include "component.h" #include "godot_cpp/variant/callable.hpp" -#include "godot_cpp/variant/utility_functions.hpp" #include "godot_cpp/variant/variant.hpp" #include "utils.h" #include "world.h" @@ -13,8 +12,6 @@ using namespace godot; -GFQuerylikeBuilder::GFQuerylikeBuilder() { -} GFQuerylikeBuilder::~GFQuerylikeBuilder() { } diff --git a/cpp/src/querylike_builder.h b/cpp/src/querylike_builder.h index 0b836cc..281d024 100644 --- a/cpp/src/querylike_builder.h +++ b/cpp/src/querylike_builder.h @@ -23,8 +23,15 @@ namespace godot { friend QueryIterationContext; public: - GFQuerylikeBuilder(); - GFQuerylikeBuilder(GFWorld* world): world(world) {} + GFQuerylikeBuilder(): + GFQuerylikeBuilder(nullptr) + {} + GFQuerylikeBuilder(GFWorld* world): + query_desc(0), + built(false), + term_count(0), + world(world) + {} ~GFQuerylikeBuilder(); // ************************************** diff --git a/cpp/src/registerable_entity.cpp b/cpp/src/registerable_entity.cpp index 0a976f4..eed06d5 100644 --- a/cpp/src/registerable_entity.cpp +++ b/cpp/src/registerable_entity.cpp @@ -1,6 +1,7 @@ #include "registerable_entity.h" #include "godot_cpp/classes/wrapped.hpp" +#include "world.h" #include #include @@ -71,14 +72,9 @@ void GFRegisterableEntity::_register_user() { GDVIRTUAL_CALL(_register, get_world()); } -Ref GFRegisterableEntity::new_internal() { - return Ref(memnew(GFRegisterableEntity)); -} - void GFRegisterableEntity::_bind_methods() { GDVIRTUAL_BIND(_register, "world"); godot::ClassDB::bind_static_method(GFRegisterableEntity::get_class_static(), D_METHOD("new_in_world", "world"), &GFRegisterableEntity::new_in_world); godot::ClassDB::bind_method(D_METHOD("_register_internal"), &GFRegisterableEntity::_register_internal); godot::ClassDB::bind_method(D_METHOD("_register_user"), &GFRegisterableEntity::_register_user); - godot::ClassDB::bind_static_method(get_class_static(), D_METHOD("_new_internal"), &GFRegisterableEntity::new_internal); } diff --git a/cpp/src/registerable_entity.h b/cpp/src/registerable_entity.h index 302c882..13a2f85 100644 --- a/cpp/src/registerable_entity.h +++ b/cpp/src/registerable_entity.h @@ -15,10 +15,15 @@ namespace godot { GDCLASS(GFRegisterableEntity, GFEntity) public: - GFRegisterableEntity(): GFEntity() {} - GFRegisterableEntity(GFWorld* world): GFEntity(world) {} + GFRegisterableEntity(): + GFRegisterableEntity(GFWorld::singleton()) + {} + GFRegisterableEntity(GFWorld* world): + GFEntity(world) + {} GFRegisterableEntity(ecs_entity_t id, GFWorld* world): - GFEntity(id, world) {} + GFEntity(id, world) + {} ~GFRegisterableEntity(); // -------------------------------------------------------- @@ -26,7 +31,6 @@ namespace godot { // -------------------------------------------------------- GDVIRTUAL1(_register, GFWorld*) - static Ref new_internal(); static Ref new_in_world(GFWorld*); static Ref from_id(ecs_entity_t id, GFWorld* world); diff --git a/cpp/src/system_builder.h b/cpp/src/system_builder.h index 58ead46..5d9adb9 100644 --- a/cpp/src/system_builder.h +++ b/cpp/src/system_builder.h @@ -18,8 +18,13 @@ namespace godot { GDCLASS(GFSystemBuilder, GFQuerylikeBuilder) public: - GFSystemBuilder(GFWorld* world): GFQuerylikeBuilder(world) {} - GFSystemBuilder(): GFSystemBuilder(GFWorld::singleton()) {} + GFSystemBuilder(GFWorld* world): + GFQuerylikeBuilder(world), + callable(Callable()) + {} + GFSystemBuilder(): + GFSystemBuilder(GFWorld::singleton()) + {} ~GFSystemBuilder(); // ************************************** diff --git a/gd/rendering/2d/systems.gd b/gd/rendering/2d/systems.gd index de13ffe..76aa1a8 100644 --- a/gd/rendering/2d/systems.gd +++ b/gd/rendering/2d/systems.gd @@ -6,7 +6,8 @@ extends GFModule func _register(w:GFWorld): #region GFCanvasItem # On add GFCanvasItem - w.observer_builder("/root/flecs/core/OnAdd") \ + GFObserverBuilder.new_in_world(w) \ + .set_events("/root/flecs/core/OnAdd") \ .with(GFCanvasItem) \ .for_each(func(item:GFCanvasItem): item.set_rid(RenderingServer.canvas_item_create()) @@ -17,7 +18,8 @@ func _register(w:GFWorld): ) # On set GFCanvasItem - w.observer_builder("/root/flecs/core/OnSet") \ + GFObserverBuilder.new_in_world(w) \ + .set_events("/root/flecs/core/OnSet") \ .with(GFCanvasItem) \ .for_each(func(item:GFCanvasItem): item.set_parent_canvas_item( @@ -26,7 +28,8 @@ func _register(w:GFWorld): ) # On remove GFCanvasItem - w.observer_builder("/root/flecs/core/OnRemove") \ + GFObserverBuilder.new_in_world(w) \ + .set_events("/root/flecs/core/OnRemove") \ .with(GFCanvasItem) \ .for_each(func(item:GFCanvasItem): RenderingServer.free_rid(item.get_rid()) @@ -35,7 +38,8 @@ func _register(w:GFWorld): #region GFPosition2D # On GFPosition2D set, update visual transform of CanvasItemC - w.observer_builder("/root/flecs/core/OnSet") \ + GFObserverBuilder.new_in_world(w) \ + .set_events("/root/flecs/core/OnSet") \ .with(GFCanvasItem).access_filter() \ .with(GFPosition2D) \ .maybe_with(GFRotation2D) \ @@ -52,7 +56,9 @@ func _register(w:GFWorld): #region GFRotation2D # On GFPosition2D set, update visual transform of GFCanvasItem - w.observer_builder("/root/flecs/core/OnSet") \ + + GFObserverBuilder.new_in_world(w) \ + .set_events("/root/flecs/core/OnSet") \ .with(GFCanvasItem).access_filter() \ .with(GFRotation2D) \ .maybe_with(GFPosition2D) \ @@ -69,7 +75,8 @@ func _register(w:GFWorld): #region GFScale2D # On GFScale2D set, update visual transform of GFCanvasItem - w.observer_builder("/root/flecs/core/OnSet") \ + GFObserverBuilder.new_in_world(w) \ + .set_events("/root/flecs/core/OnSet") \ .with(GFCanvasItem).access_filter() \ .with(GFScale2D) \ .maybe_with(GFPosition2D) \ @@ -85,12 +92,14 @@ func _register(w:GFWorld): #endregion #region GFTexture2D - w.observer_builder("/root/flecs/core/OnAdd") \ + GFObserverBuilder.new_in_world(w) \ + .set_events("/root/flecs/core/OnAdd") \ .with(GFTexture2D) \ .with(GFCanvasItem) \ .for_each(GFTexture2D.update_texture_rect) - w.observer_builder("/root/flecs/core/OnSet") \ + GFObserverBuilder.new_in_world(w) \ + .set_events("/root/flecs/core/OnSet") \ .with(GFTexture2D) \ .with(GFCanvasItem) \ .for_each(GFTexture2D.update_texture_rect) diff --git a/unittests/test_components.gd b/unittests/test_components.gd index 8bac7c3..fb7da35 100644 --- a/unittests/test_components.gd +++ b/unittests/test_components.gd @@ -66,10 +66,9 @@ func test_registration(): func test_simple_system(): - world.system_builder() \ + GFSystemBuilder.new_in_world(world) \ .with(Foo) \ .for_each(func(foo): - prints("REA", foo.get_script()) foo.set_value(Vector2(2, 5)) ) @@ -142,7 +141,7 @@ class RegistrationA extends GFComponent: setm(&"result", v) func _register(w: GFWorld): - w.system_builder() \ + GFSystemBuilder.new_in_world(w) \ .with(RegistrationA) \ .with(RegistrationB) \ .for_each(func(reg_a:RegistrationA, reg_b:RegistrationB): @@ -164,8 +163,8 @@ class RegistrationB extends GFComponent: func set_result(v:float) -> void: setm(&"result", v) - func _register(world:GFWorld): - world.system_builder() \ + func _register(w:GFWorld): + GFSystemBuilder.new_in_world(w) \ .with(RegistrationA) \ .with(RegistrationB) \ .for_each(func(reg_a:RegistrationA, reg_b:RegistrationB): diff --git a/unittests/test_ecs_world.gd b/unittests/test_ecs_world.gd index 2cf7b73..35c06d8 100644 --- a/unittests/test_ecs_world.gd +++ b/unittests/test_ecs_world.gd @@ -68,7 +68,7 @@ func test_world_deletion(): assert_eq(foo.is_alive(), false) func test_simple_system(): - world.system_builder() \ + GFSystemBuilder.new_in_world(world) \ .with(Foo) \ .for_each(func(foo:Foo): foo.setm(&"vec", 2.67) diff --git a/unittests/test_events.gd b/unittests/test_events.gd index d7b4342..2ef4740 100644 --- a/unittests/test_events.gd +++ b/unittests/test_events.gd @@ -14,7 +14,8 @@ func after_each(): func test_on_add_event(): var data:= {i=0} - world.observer_builder("flecs/core/OnAdd") \ + GFObserverBuilder.new_in_world(world) \ + .set_events("flecs/core/OnAdd") \ .with(Ints) \ .for_each(func(_ints: Ints): data.i += 1 @@ -42,7 +43,8 @@ func test_on_add_event(): # test events on_set_event func test_on_set_event(): var data:= {i=0} - world.observer_builder("flecs/core/OnSet") \ + GFObserverBuilder.new_in_world(world) \ + .set_events("flecs/core/OnSet") \ .with(Ints) \ .for_each(func(ints: Ints): data.i += ints.a + ints.b @@ -70,7 +72,8 @@ func test_on_set_event(): func test_on_add_event_with_objects(): var data:= {i=0} - world.observer_builder("flecs/core/OnAdd") \ + GFObserverBuilder.new_in_world(world) \ + .set_events("flecs/core/OnAdd") \ .with(Textures) \ .for_each(func(_ints: Textures): data.i += 1 diff --git a/unittests/test_prefab.gd b/unittests/test_prefab.gd index d54917a..43dcbcc 100644 --- a/unittests/test_prefab.gd +++ b/unittests/test_prefab.gd @@ -14,7 +14,7 @@ func after_all(): # test prefab prefab func test_prefab(): - world.system_builder() \ + GFSystemBuilder.new_in_world(world) \ .with(Foo) \ .with(Bar) \ .for_each(func(f:Foo, b:Bar): diff --git a/unittests/test_queries.gd b/unittests/test_queries.gd index 23524fc..96a7e38 100644 --- a/unittests/test_queries.gd +++ b/unittests/test_queries.gd @@ -37,7 +37,7 @@ func test_optional_terms(): data.ints = 0 data.bools = 0 - w.system_builder() \ + GFSystemBuilder.new_in_world(world) \ .with(Ints) \ .maybe_with(Bools) \ .for_each(callable) @@ -47,7 +47,7 @@ func test_optional_terms(): data.ints = 0 data.bools = 0 - w.system_builder() \ + GFSystemBuilder.new_in_world(world) \ .maybe_with(Ints) \ .with(Bools) \ .for_each(callable) @@ -59,7 +59,7 @@ func test_or_operation_terms(): var w:= world var data:= {ints=0, bools=0} - w.system_builder() \ + GFSystemBuilder.new_in_world(world) \ .with(Bools).or_with(Ints) \ .for_each(func(bools_or_ints:GFComponent): if bools_or_ints is Ints: diff --git a/unittests/test_relations.gd b/unittests/test_relations.gd index 13f1613..7279d76 100644 --- a/unittests/test_relations.gd +++ b/unittests/test_relations.gd @@ -52,7 +52,8 @@ func test_basic_query(): .set_name("Cow") \ .add_pair("Eats", grass) - var grass_eater_iter:= world.query_builder() \ + var grass_eater_iter:= GFQueryBuilder \ + .new_in_world(world) \ .with(eats.pair(grass)) \ .build() as GFQuery var grass_eater_count:= 0 @@ -60,7 +61,8 @@ func test_basic_query(): grass_eater_count += 1 assert_eq(grass_eater_count, 1) - var eater_iter:= world.query_builder() \ + var eater_iter:= GFQueryBuilder \ + .new_in_world(world) \ .with(eats.pair("flecs/core/*")) \ .build() as GFQuery var eater_count:= 0 diff --git a/unittests/test_simple_systems.gd b/unittests/test_simple_systems.gd index 122f094..253155b 100644 --- a/unittests/test_simple_systems.gd +++ b/unittests/test_simple_systems.gd @@ -52,7 +52,7 @@ func after_all(): #entity.free() func test_bools(): - world.system_builder() \ + GFSystemBuilder.new_in_world(world) \ .with(Bools) \ .for_each(func(x:Bools): x.b = x.a @@ -71,7 +71,7 @@ func test_bools(): entity.delete() func test_ints(): - world.system_builder() \ + GFSystemBuilder.new_in_world(world) \ .with(Ints) \ .for_each(func(x:Ints): x.b *= 2 @@ -92,7 +92,7 @@ func test_ints(): entity.delete() func test_floats(): - world.system_builder() \ + GFSystemBuilder.new_in_world(world) \ .with(Floats) \ .for_each(func(x:Floats): x.b *= 2 @@ -114,7 +114,7 @@ func test_floats(): # test simple_systems strings func test_strings(): - world.system_builder() \ + GFSystemBuilder.new_in_world(world) \ .with(Strings) \ .for_each(func(x:Strings): x.b += "em" @@ -138,7 +138,7 @@ func test_strings(): entity.delete() func test_byte_arrays(): - world.system_builder() \ + GFSystemBuilder.new_in_world(world) \ .with(ByteArrays) \ .for_each(func(x:ByteArrays): for i in range(x.a.size()): @@ -161,7 +161,7 @@ func test_byte_arrays(): # test simple_systems textures func test_textures(): - world.system_builder() \ + GFSystemBuilder.new_in_world(world) \ .with(Textures) \ .for_each(func(x:Textures): x.a = x.b @@ -205,7 +205,7 @@ func test_ref_counts(): entity.delete() func test_arrays(): - world.system_builder() \ + GFSystemBuilder.new_in_world(world) \ .with(Arrays) \ .for_each(func(x:Arrays): for i in mini(x.a.size(), x.b.size()): @@ -228,7 +228,7 @@ func test_arrays(): entity.delete() func test_dicts(): - world.system_builder() \ + GFSystemBuilder.new_in_world(world) \ .with(Dicts) \ .for_each(func(x:Dicts): x.b["value"] += x.a["add_by"] diff --git a/unittests/test_systems.gd b/unittests/test_systems.gd index abb4eb8..045d913 100644 --- a/unittests/test_systems.gd +++ b/unittests/test_systems.gd @@ -15,7 +15,7 @@ func after_each(): func test_stuff(): pass #world.system_builder(&"test_pipeline") \ - world.system_builder() \ + GFSystemBuilder.new_in_world(world) \ .with(Bools) \ .for_each(func(boo:Bools): boo.b = boo.a