Made the components module work like textures and sound so that there's just one constant map of components.

This commit is contained in:
Zed A. Shaw 2025-06-02 23:33:59 -04:00
parent ab391aaa97
commit f208ca946e
10 changed files with 42 additions and 41 deletions

View file

@ -11,7 +11,6 @@ using std::shared_ptr, std::make_shared;
using namespace components;
LevelManager::LevelManager() {
components::configure($components);
create_level();
}
@ -47,7 +46,7 @@ shared_ptr<gui::BossFightUI> LevelManager::create_bossfight(shared_ptr<DinkyECS:
auto& boss_data = config.bosses[level_name];
auto boss_id = world->entity();
components::configure_entity($components, *world, boss_id, boss_data["components"]);
components::configure_entity(*world, boss_id, boss_data["components"]);
return make_shared<gui::BossFightUI>(world, boss_id);
}
@ -59,7 +58,7 @@ DinkyECS::Entity LevelManager::spawn_enemy(std::string named) {
auto &config = level.world->get_the<GameConfig>();
auto entity_data = config.enemies[named];
WorldBuilder builder(*level.map, $components);
WorldBuilder builder(*level.map);
auto entity_id = builder.configure_entity_in_room(*level.world, entity_data, 0);
@ -87,7 +86,7 @@ size_t LevelManager::create_level(shared_ptr<DinkyECS::World> prev_world) {
auto scaling = scale_level();
auto map = make_shared<Map>(scaling.map_width, scaling.map_height);
WorldBuilder builder(*map, $components);
WorldBuilder builder(*map);
builder.generate(*world);
size_t index = $levels.size();