Refactored the ansi_parser into a class that can be reused between render calls.
This commit is contained in:
parent
e864e14eab
commit
fd8180bc61
6 changed files with 68 additions and 27 deletions
|
@ -53,14 +53,11 @@ std::string generate_colors() {
|
|||
|
||||
TEST_CASE("test out ragel parser", "[gui]") {
|
||||
std::string colors = generate_colors();
|
||||
|
||||
std::wstring_convert<std::codecvt_utf8_utf16<wchar_t>> converter;
|
||||
std::wstring colors_utf8 = converter.from_bytes(colors);
|
||||
|
||||
sf::Color default_fg(0,0,0);
|
||||
sf::Color default_bg(100,100,100);
|
||||
ANSIParser parser(default_fg, default_bg);
|
||||
|
||||
bool good = parse_ansi(colors_utf8, default_fg, default_bg, [&](sf::Color bgcolor, sf::Color color, wchar_t ch) {
|
||||
bool good = parser.parse(colors, [&](sf::Color bgcolor, sf::Color color, wchar_t ch) {
|
||||
bool correct_char = ch == '#' || ch == ' ' || ch == '\n' || ch == '\r';
|
||||
// println("FG: {},{},{},{}; BG: {},{},{},{}; ch: {}",
|
||||
// color.r, color.g, color.b, color.a,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue