Fix up the colors and rendering so that tilemap just uses components::Tile all the time. Need to load all of the config data from json one time on system start instead of constantly, although constantly does make debugging live easier.

This commit is contained in:
Zed A. Shaw 2025-02-09 15:54:17 -05:00
parent a4c13f7fc9
commit 0cbe20af35
10 changed files with 36 additions and 44 deletions

View file

@ -238,12 +238,12 @@ void System::draw_entities(DinkyECS::World &world, Map &map, const Matrix &light
Point loc = map.map_to_camera(pos.location, cam_orig);
float light_value = lights[pos.location.y][pos.location.x] * PERCENT;
const TileCell& cell = tiles.at(pos.location.x, pos.location.y);
const Tile& cell = tiles.at(pos.location.x, pos.location.y);
// the 2 and 4 are from ftxui::Canvas since it does a kind of "subpixel" drawing
canvas.DrawText(loc.x*2, loc.y*4, tile.chr, [tile, light_value, cell](auto &pixel) {
canvas.DrawText(loc.x*2, loc.y*4, tile.display, [tile, light_value, cell](auto &pixel) {
pixel.foreground_color = Color::HSV(tile.foreground[0], tile.foreground[1], tile.foreground[2] * light_value);
pixel.background_color = Color::HSV(cell.bg_h, cell.bg_s, cell.bg_v * light_value);
pixel.background_color = Color::HSV(cell.background[0], cell.background[1], cell.background[2] * light_value);
});
}
});