Initial changes to clean up the code.

This commit is contained in:
Zed A. Shaw 2025-01-10 11:12:14 -05:00
parent 8d3ccd935d
commit f3f875ee80
8 changed files with 21 additions and 29 deletions

View file

@ -18,19 +18,7 @@ TEST_CASE("load a basic gui run but don't loop", "[gui]") {
save::load_configs(world);
Map game_map(40, 40);
WorldBuilder builder(game_map);
builder.generate_map();
auto &config = world.get_the<GameConfig>();
// configure a player as a fact of the world
Player player{world.entity()};
world.set_the<Player>(player);
world.set<Position>(player.entity, {game_map.place_entity(0)});
world.set<Motion>(player.entity, {0, 0});
world.set<Combat>(player.entity, {100, 10});
world.set<Tile>(player.entity, {config.enemies["PLAYER_TILE"]["display"]});
world.set<Inventory>(player.entity, {5});
world.set<LightSource>(player.entity, {6,1});
builder.generate(world);
SpatialMap collider;
world.set_the<SpatialMap>(collider);

View file

@ -17,9 +17,9 @@ using namespace components;
DinkyECS::Entity add_items(DinkyECS::World &world, GameConfig &config) {
auto sword = world.entity();
world.set<InventoryItem>(sword, {1, config.items["SWORD_RUSTY"]});
world.set<Tile>(sword, {config.items["SWORD_RUSTY"]["display"]});
json& item_data = config.items["SWORD_RUSTY"];
world.set<InventoryItem>(sword, {item_data["inventory_count"], item_data});
components::configure(world, sword, item_data);
return sword;
}

View file

@ -296,11 +296,7 @@ TEST_CASE("viewport iterator", "[matrix:viewport]") {
for(size_t y = 0; y < end_y; ++y) {
for(size_t x = 0; x < end_x && it.next(); ++x) {
println("view x/y={},{}; w/h={},{}; start={},{}",
it.x, it.y, it.width, it.height, it.start.x, it.start.y);
println("orig x/y={},{}; w/h={},{}; start={},{}\n",
x+start.x, y+start.y, view_width, view_height, start.x, start.y);
// still working on this
}
}
}