#include "components.hpp" #include "point.hpp" #include "easings.hpp" namespace components { static ComponentMap MAP; static bool MAP_configured = false; void configure_entity(DinkyECS::World& world, DinkyECS::Entity ent, json& data) { for (auto &i : data) { dbc::check(i.contains("_type") && i["_type"].is_string(), fmt::format("component has no _type: {}", data.dump())); dbc::check(MAP.contains(i["_type"]), fmt::format("MAP doesn't have type {}", std::string(i["_type"]))); MAP.at(i["_type"])(world, ent, i); } } void init() { if(!MAP_configured) { components::enroll(MAP); components::enroll(MAP); components::enroll(MAP); components::enroll(MAP); components::enroll(MAP); components::enroll(MAP); components::enroll(MAP); components::enroll(MAP); components::enroll(MAP); components::enroll(MAP); components::enroll(MAP); components::enroll(MAP); components::enroll(MAP); components::enroll(MAP); MAP_configured = true; } } }