You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
36 lines
1.2 KiB
36 lines
1.2 KiB
#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<BossFight>(MAP);
|
|
components::enroll<Combat>(MAP);
|
|
components::enroll<Position>(MAP);
|
|
components::enroll<Weapon>(MAP);
|
|
components::enroll<Curative>(MAP);
|
|
components::enroll<EnemyConfig>(MAP);
|
|
components::enroll<Personality>(MAP);
|
|
components::enroll<Tile>(MAP);
|
|
components::enroll<Motion>(MAP);
|
|
components::enroll<LightSource>(MAP);
|
|
components::enroll<Device>(MAP);
|
|
components::enroll<Sprite>(MAP);
|
|
components::enroll<Animation>(MAP);
|
|
components::enroll<Sound>(MAP);
|
|
MAP_configured = true;
|
|
}
|
|
}
|
|
}
|
|
|