{"id":20708407,"url":"https://github.com/weakknight/ecs","last_synced_at":"2026-04-18T20:02:27.179Z","repository":{"id":132492305,"uuid":"522848808","full_name":"WeakKnight/ECS","owner":"WeakKnight","description":"A tiny ECS library which mimics EnTT's API.","archived":false,"fork":false,"pushed_at":"2022-09-25T15:24:03.000Z","size":23,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-01-17T20:40:41.085Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/WeakKnight.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-08-09T07:35:06.000Z","updated_at":"2023-03-25T14:52:55.000Z","dependencies_parsed_at":null,"dependency_job_id":"79a17a12-f390-4cf3-aa4c-172a40c1c2be","html_url":"https://github.com/WeakKnight/ECS","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/WeakKnight%2FECS","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/WeakKnight%2FECS/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/WeakKnight%2FECS/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/WeakKnight%2FECS/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/WeakKnight","download_url":"https://codeload.github.com/WeakKnight/ECS/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":242978013,"owners_count":20215895,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-17T01:31:04.386Z","updated_at":"2026-04-18T20:02:27.134Z","avatar_url":"https://github.com/WeakKnight.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ECS\nA tiny ECS library which mimics [EnTT](https://github.com/skypjack/entt)'s API.\n``` cpp\n#include \"ECS.h\"\n\nstruct Position\n{\n\tCOMPONENT_CTOR(float px, float py)\n\t{\n\t\tx = px;\n\t\ty = py;\n\t}\n\n\tfloat x;\n\tfloat y;\n};\n\nstruct Velocity\n{\n\tCOMPONENT_CTOR(float pdx, float pdy)\n\t{\n\t\tdx = pdx;\n\t\tdy = pdy;\n\t}\n\n\tfloat dx;\n\tfloat dy;\n};\n\nstruct Movable\n{\n\tCOMPONENT_CTOR()\n\t{\n\t}\n};\n\ntypedef ECS::Entity Entity;\n\nint main()\n{\n\tECS::Init();\n\n\tfor (int i = 0; i \u003c 100; i++)\n\t{\n\t\tEntity entity = Entity::Create();\n\n\t\tentity.AddComponent\u003cPosition\u003e(i * 1.0f, i * 1.0f);\n\t\tentity.AddComponent\u003cVelocity\u003e(i * 1.0f, i * 1.0f);\n\n\t\tif (i % 2 == 0)\n\t\t{\n\t\t\tentity.AddComponent\u003cVelocity\u003e(i * 1.0f, i * 1.0f);\n\t\t\tif (i % 3 == 0)\n\t\t\t{\n\t\t\t\tauto movable = entity.AddComponent\u003cMovable\u003e();\n\t\t\t\tauto entityPrime = Entity::FromComponent(movable);\n\t\t\t\tassert(entity == entityPrime);\n\t\t\t}\n\t\t}\n\t}\n\n\tEntity::ForEach\u003cPosition, Velocity, Movable\u003e([](ECS::ComponentHandle\u003cPosition\u003e position, ECS::ComponentHandle\u003cVelocity\u003e velocity, ECS::ComponentHandle\u003cMovable\u003e) {\n\t\tposition-\u003ex += velocity-\u003edx;\n\t\tposition-\u003ey += velocity-\u003edy;\n\t\tprintf(\"[x: %f, y: %f]\\n\", position-\u003ex, position-\u003ey);\n\t});\n\n\tECS::Release();\n\n\treturn 0;\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fweakknight%2Fecs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fweakknight%2Fecs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fweakknight%2Fecs/lists"}