Started prototyping a viewport iterator but couldn't get it right so I'll test drive it next.
This commit is contained in:
parent
4cb41a61db
commit
1962b0c24e
2 changed files with 43 additions and 7 deletions
15
gui.cpp
15
gui.cpp
|
@ -98,7 +98,8 @@ void MapViewUI::draw_map() {
|
|||
size_t end_y = std::min(size_t(height), $game_map.height() - start.y);
|
||||
|
||||
for(size_t y = 0; y < end_y; ++y) {
|
||||
for(size_t x = 0; x < end_x; ++x) {
|
||||
for(size_t x = 0; x < end_x; ++x)
|
||||
{
|
||||
const TileCell& 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;
|
||||
|
@ -108,14 +109,14 @@ void MapViewUI::draw_map() {
|
|||
string num = dnum > 15 ? "*" : format("{:x}", dnum);
|
||||
|
||||
$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.foreground_color = Color::HSV(dnum * 20, 150, 200);
|
||||
pixel.background_color = Color::HSV(30, 20, tile.bg_v * 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.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);
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue