Skip to content
This repository has been archived by the owner on Oct 8, 2023. It is now read-only.

Function-like macros #7

Closed
lithiumtoast opened this issue Jun 5, 2022 · 1 comment
Closed

Function-like macros #7

lithiumtoast opened this issue Jun 5, 2022 · 1 comment

Comments

@lithiumtoast
Copy link
Member

lithiumtoast commented Jun 5, 2022

Function like macros like the following should be supported through C2CS bottlenoselabs/c2cs#35

#define ECS_COMPONENT_DEFINE(world, id) \
    {\
        ecs_component_desc_t desc = {0}; \
        desc.entity.entity = ecs_id(id); \
        desc.entity.name = #id; \
        desc.entity.symbol = #id; \
        desc.size = sizeof(id); \
        desc.alignment = ECS_ALIGNOF(id); \
        ecs_id(id) = ecs_component_init(world, &desc);\
        ecs_assert(ecs_id(id) != 0, ECS_INVALID_PARAMETER, NULL);\
    }

How to handle the generic type parameter id needs research/tinkering.

@lithiumtoast
Copy link
Member Author

Doing it my hand manually

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant