Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

feat: multi field association API #243

Merged
merged 3 commits into from
May 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions ecsact/runtime/common.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ ECSACT_TYPED_ID(ecsact_transient_id);
ECSACT_TYPED_ID(ecsact_enum_id);
ECSACT_TYPED_ID(ecsact_enum_value_id);
ECSACT_TYPED_ID(ecsact_field_id);
ECSACT_TYPED_ID(ecsact_system_assoc_id);
ECSACT_TYPED_ID(ecsact_variant_id);
ECSACT_TYPED_ID(ecsact_registry_id);
ECSACT_TYPED_ID(ecsact_entity_id);
Expand Down Expand Up @@ -222,6 +223,11 @@ typedef enum {
} ecsact_execute_systems_error;

typedef enum {
/**
* System has no capabilities for this component.
*/
ECSACT_SYS_CAP_NONE = 0,

/**
* System may read component
*/
Expand Down
47 changes: 47 additions & 0 deletions ecsact/runtime/dynamic.h
Original file line number Diff line number Diff line change
Expand Up @@ -378,6 +378,44 @@ ECSACT_DYNAMIC_API_FN(void, ecsact_unset_system_capability)
ecsact_component_like_id
);

ECSACT_DYNAMIC_API_FN(ecsact_system_assoc_id, ecsact_add_system_assoc)
( //
ecsact_system_like_id
);

ECSACT_DYNAMIC_API_FN(void, ecsact_remove_system_assoc)
( //
ecsact_system_like_id,
ecsact_system_assoc_id
);

ECSACT_DYNAMIC_API_FN(void, ecsact_add_system_assoc_field)
( //
ecsact_system_like_id,
ecsact_system_assoc_id,
ecsact_component_like_id,
ecsact_field_id
);

ECSACT_DYNAMIC_API_FN(void, ecsact_remove_system_assoc_field)
( //
ecsact_system_like_id,
ecsact_system_assoc_id,
ecsact_component_like_id,
ecsact_field_id
);

ECSACT_DYNAMIC_API_FN(void, ecsact_set_system_assoc_capbility)
( //
ecsact_system_like_id,
ecsact_system_assoc_id,
ecsact_component_like_id,
ecsact_system_capability
);

/**
* @deprecated use ecsact_set_system_assoc_capbility instead
*/
ECSACT_DYNAMIC_API_FN(void, ecsact_set_system_association_capability)
( //
ecsact_system_like_id,
Expand All @@ -387,6 +425,10 @@ ECSACT_DYNAMIC_API_FN(void, ecsact_set_system_association_capability)
ecsact_system_capability
);

/**
* @deprecated use ecsact_set_system_assoc_capbility with ECSACT_SYS_CAP_NONE
* instead
*/
ECSACT_DYNAMIC_API_FN(void, ecsact_unset_system_association_capability)
( //
ecsact_system_like_id,
Expand Down Expand Up @@ -499,6 +541,11 @@ ECSACT_DYNAMIC_API_FN(void, ecsact_set_system_notify_component_setting)
fn(ecsact_remove_enum_value, __VA_ARGS__); \
fn(ecsact_set_system_capability, __VA_ARGS__); \
fn(ecsact_unset_system_capability, __VA_ARGS__); \
fn(ecsact_add_system_assoc, __VA_ARGS__); \
fn(ecsact_remove_system_assoc, __VA_ARGS__); \
fn(ecsact_add_system_assoc_field, __VA_ARGS__); \
fn(ecsact_remove_system_assoc_field, __VA_ARGS__); \
fn(ecsact_set_system_assoc_capbility, __VA_ARGS__); \
fn(ecsact_set_system_association_capability, __VA_ARGS__); \
fn(ecsact_unset_system_association_capability, __VA_ARGS__); \
fn(ecsact_add_system_generates, __VA_ARGS__); \
Expand Down
62 changes: 62 additions & 0 deletions ecsact/runtime/meta.h
Original file line number Diff line number Diff line change
Expand Up @@ -284,12 +284,62 @@ ECSACT_META_API_FN(void, ecsact_meta_system_capabilities)
int32_t* out_capabilities_count
);

ECSACT_META_API_FN(int32_t, ecsact_meta_system_assoc_count)
( //
ecsact_system_like_id system_id
);

ECSACT_META_API_FN(int32_t, ecsact_meta_system_assoc_ids)
( //
ecsact_system_like_id system_id,
int32_t max_assoc_count,
ecsact_system_assoc_id* out_assoc_ids,
int32_t* out_assoc_count
);

ECSACT_META_API_FN(int32_t, ecsact_meta_system_assoc_fields_count)
( //
ecsact_system_like_id system_id,
ecsact_system_assoc_id assoc_id
);

ECSACT_META_API_FN(int32_t, ecsact_meta_system_assoc_fields)
( //
ecsact_system_like_id system_id,
ecsact_system_assoc_id assoc_id,
int32_t max_fields_count,
ecsact_field_id* out_fields,
int32_t* out_fields_count
);

ECSACT_META_API_FN(int32_t, ecsact_meta_system_assoc_capabilities_count)
( //
ecsact_system_like_id system_id,
ecsact_system_assoc_id assoc_id
);

ECSACT_META_API_FN(void, ecsact_meta_system_assoc_capabilities)
( //
ecsact_system_like_id system_id,
ecsact_system_assoc_id assoc_id,
int32_t max_capabilities_count,
ecsact_component_like_id* out_capability_component_ids,
ecsact_system_capability* out_capabilities,
int32_t* out_capabilities_count
);

/**
* @deprecated use ecsact_meta_system_assoc_* fns instead
*/
ECSACT_META_API_FN(int32_t, ecsact_meta_system_association_fields_count)
( //
ecsact_system_like_id system_id,
ecsact_component_like_id component_id
);

/**
* @deprecated use ecsact_meta_system_assoc_* fns instead
*/
ECSACT_META_API_FN(void, ecsact_meta_system_association_fields)
( //
ecsact_system_like_id system_id,
Expand All @@ -299,13 +349,19 @@ ECSACT_META_API_FN(void, ecsact_meta_system_association_fields)
int32_t* out_fields_count
);

/**
* @deprecated use ecsact_meta_system_assoc_* fns instead
*/
ECSACT_META_API_FN(int32_t, ecsact_meta_system_association_capabilities_count)
( //
ecsact_system_like_id system_id,
ecsact_component_like_id component_id,
ecsact_field_id field_id
);

/**
* @deprecated use ecsact_meta_system_assoc_* fns instead
*/
ECSACT_META_API_FN(void, ecsact_meta_system_association_capabilities)
( //
ecsact_system_like_id system_id,
Expand Down Expand Up @@ -477,6 +533,12 @@ ECSACT_META_API_FN(void, ecsact_meta_system_notify_settings)
fn(ecsact_meta_system_name, __VA_ARGS__); \
fn(ecsact_meta_system_capabilities_count, __VA_ARGS__); \
fn(ecsact_meta_system_capabilities, __VA_ARGS__); \
fn(ecsact_meta_system_assoc_count, __VA_ARGS__); \
fn(ecsact_meta_system_assoc_ids, __VA_ARGS__); \
fn(ecsact_meta_system_assoc_fields_count, __VA_ARGS__); \
fn(ecsact_meta_system_assoc_fields, __VA_ARGS__); \
fn(ecsact_meta_system_assoc_capabilities_count, __VA_ARGS__); \
fn(ecsact_meta_system_assoc_capabilities, __VA_ARGS__); \
fn(ecsact_meta_system_association_fields_count, __VA_ARGS__); \
fn(ecsact_meta_system_association_fields, __VA_ARGS__); \
fn(ecsact_meta_system_association_capabilities_count, __VA_ARGS__); \
Expand Down
Loading