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:
parent
a4c13f7fc9
commit
0cbe20af35
10 changed files with 36 additions and 44 deletions
8
gui.cpp
8
gui.cpp
|
@ -37,7 +37,7 @@ namespace gui {
|
|||
for(size_t y = 0; y < end_y; ++y) {
|
||||
for(size_t x = 0; x < end_x; ++x)
|
||||
{
|
||||
const TileCell& tile = tiles.at(start.x+x, start.y+y);
|
||||
const Tile& tile = tiles.at(start.x+x, start.y+y);
|
||||
// light value is an integer that's a percent
|
||||
float light_value = debug.LIGHT ? 80 * PERCENT : lighting[start.y+y][start.x+x] * PERCENT;
|
||||
int dnum = debug.PATHS ? paths[start.y+y][start.x+x] : WALL_PATH_LIMIT;
|
||||
|
@ -47,12 +47,12 @@ namespace gui {
|
|||
|
||||
$canvas.DrawText(x * 2, y * 4, num, [dnum, tile, light_value](auto &pixel) {
|
||||
pixel.foreground_color = Color::HSV(dnum * 20, 150, 200);
|
||||
pixel.background_color = Color::HSV(30, 20, tile.bg_v * 50 * PERCENT);
|
||||
pixel.background_color = Color::HSV(30, 20, tile.foreground[2] * 50 * PERCENT);
|
||||
});
|
||||
} else {
|
||||
$canvas.DrawText(x * 2, y * 4, tile.display, [tile, light_value](auto &pixel) {
|
||||
pixel.foreground_color = Color::HSV(tile.fg_h, tile.fg_s, tile.fg_v * light_value);
|
||||
pixel.background_color = Color::HSV(tile.bg_h, tile.bg_s, tile.bg_v * light_value);
|
||||
pixel.foreground_color = Color::HSV(tile.foreground[0], tile.foreground[1], tile.foreground[2] * light_value);
|
||||
pixel.background_color = Color::HSV(tile.background[0], tile.background[1], tile.background[2] * light_value);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue