Skip to content

Commit

Permalink
#124 update c/23_get_children to use new vector API
Browse files Browse the repository at this point in the history
  • Loading branch information
SanderMertens committed Jan 6, 2020
1 parent 374f21b commit c914121
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 7 deletions.
8 changes: 2 additions & 6 deletions examples/c/23_get_children/src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,13 @@
typedef int Foo;
typedef int Bar;

ecs_vector_params_t entity_params = {
.element_size = sizeof(ecs_entity_t)
};

void GetChildren(ecs_rows_t *rows) {
ecs_vector_t **children = rows->param;

for (int i = 0; i < rows->count; i ++) {
ecs_entity_t *elem = ecs_vector_add(
children,
&entity_params);
ecs_entity_t);

*elem = rows->entities[i];
}
Expand Down Expand Up @@ -59,7 +55,7 @@ int main(int argc, char *argv[]) {
ecs_set(world, child_2_2, EcsId, {"child_2_2"});

/* Create vector to store child entities */
ecs_vector_t *children = ecs_vector_new(&entity_params, 0);
ecs_vector_t *children = ecs_vector_new(ecs_entity_t, 0);

/* Collect children for parent_1 */
ecs_run_w_filter(world, GetChildren, 0, 0, 0,
Expand Down
2 changes: 1 addition & 1 deletion include/flecs/util/sparse.h
Original file line number Diff line number Diff line change
Expand Up @@ -104,4 +104,4 @@ void ecs_sparse_memory(
}
#endif

#endif
#endif

0 comments on commit c914121

Please sign in to comment.