Rendering with color is working now but still has problems with enabling/resetting the default colors.
This commit is contained in:
parent
a36b187879
commit
e864e14eab
8 changed files with 57 additions and 45 deletions
|
@ -6,6 +6,7 @@
|
|||
#include "collider.hpp"
|
||||
#include "events.hpp"
|
||||
#include "ftxui/screen/color.hpp"
|
||||
#include "ftxui/screen/terminal.hpp" // for SetColorSupport, Color, TrueColor
|
||||
|
||||
using std::string;
|
||||
using namespace fmt;
|
||||
|
@ -126,7 +127,7 @@ void System::draw_entities(DinkyECS::World &world, Map &game_map, ftxui::Canvas
|
|||
&& 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);
|
||||
// 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);
|
||||
canvas.DrawText(loc.x*2, loc.y*4, tile.chr, Color::RGB(255, 50, 50));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -144,7 +145,11 @@ void System::draw_map(DinkyECS::World &world, Map &game_map, ftxui::Canvas &canv
|
|||
for(size_t y = 0; y < end_y; ++y) {
|
||||
string tile = walls[start.y+y][start.x+x] == 1 ? WALL_TILE : FLOOR_TILE;
|
||||
// the 2 and 4 are from ftxui::Canvas since it does a kind of "subpixel" drawing
|
||||
canvas.DrawText(x * 2, y * 4, tile, Color::HSV(100, 10, 10));
|
||||
if(tile == WALL_TILE) {
|
||||
canvas.DrawText(x * 2, y * 4, tile, Color::RGB(70, 70, 70));
|
||||
} else {
|
||||
canvas.DrawText(x * 2, y * 4, tile, Color::RGB(20, 20, 20));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue