Map is now working well and all light is good but it's causing saturation fatigue because of the low levels and low saturation. I'll have to work on contrast and probably jut up the wall contrast.

This commit is contained in:
Zed A. Shaw 2024-11-28 04:27:14 -05:00
parent 1fab1d2d6d
commit 988edf13d7
5 changed files with 16 additions and 19 deletions

View file

@ -138,7 +138,8 @@ void System::collision(DinkyECS::World &world, Player &player) {
world.send<Events::GUI>(Events::GUI::LOOT, entity, loot);
inventory.gold += loot.amount;
light.strength = 3;
light.strength = 4;
light.distance = 2;
collider.remove(loot_pos.location);
} else {
println("UNKNOWN COLLISION TYPE {}", entity);
@ -154,12 +155,13 @@ void System::draw_entities(DinkyECS::World &world, Map &game_map, ftxui::Canvas
if(pos.location.x >= cam_orig.x && pos.location.x <= cam_orig.x + view_x
&& pos.location.y >= cam_orig.y && pos.location.y <= cam_orig.y + view_y) {
Point loc = game_map.map_to_camera(pos.location, cam_orig);
int light_value = lighting[pos.location.y][pos.location.x];
// 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, [light_value](auto &pixel) {
pixel.foreground_color = Color::HSV(255, 200, light_value + 20);
pixel.background_color = Color::HSV(30, 20, light_value / 5);
pixel.background_color = Color::HSV(30, 20, light_value / 3);
});
}
});
@ -180,19 +182,12 @@ void System::draw_map(DinkyECS::World &world, Map &game_map, ftxui::Canvas &canv
for(size_t x = 0; x < end_x; ++x) {
for(size_t y = 0; y < end_y; ++y) {
string tile = walls[start.y+y][start.x+x] == 1 ? config.WALL_TILE : config.FLOOR_TILE;
// "WALL_TILE": "\u2591",
// "WALL_TILE": "\ua5b8",
int light_value = lighting[start.y+y][start.x+x];
if(tile == config.WALL_TILE) {
canvas.DrawText(x * 2, y * 4, config.WALL_TILE, [light_value](auto &pixel) {
if(light_value > lighting::MIN) {
pixel.foreground_color = Color::HSV(230, 20, 10);
pixel.background_color = Color::HSV(230, 20, light_value / 2);
} else {
pixel.foreground_color = Color::HSV(230, 20, 20);
pixel.background_color = Color::HSV(230, 20, 30);
}
pixel.foreground_color = Color::HSV(230, 20, 10);
pixel.background_color = Color::HSV(230, 20, light_value / 2);
});
} else if(DEBUG_MAP) {
int dnum = paths[start.y+y][start.x+x];
@ -206,7 +201,7 @@ void System::draw_map(DinkyECS::World &world, Map &game_map, ftxui::Canvas &canv
} else {
canvas.DrawText(x * 2, y * 4, tile, [light_value](auto &pixel) {
pixel.foreground_color = Color::HSV(30, 40, light_value);
pixel.background_color = Color::HSV(30, 20, light_value / 5);
pixel.background_color = Color::HSV(30, 20, light_value / 3);
});
}
}