Renderer of ANSI codes to SFML is now working. Does seem to be a little slow but that'll be easy to fix later.
This commit is contained in:
parent
ae484bf425
commit
a36b187879
8 changed files with 96 additions and 62 deletions
|
@ -2,6 +2,7 @@
|
|||
#include <fmt/core.h>
|
||||
#include <string>
|
||||
#include "ansi_parser.hpp"
|
||||
#include <codecvt>
|
||||
|
||||
|
||||
#include "ftxui/dom/elements.hpp" // for text, bgcolor, color, vbox, hbox, separator, operator|, Elements, Element, Fit, border
|
||||
|
@ -52,11 +53,14 @@ 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);
|
||||
|
||||
println("--- PARSING");
|
||||
bool good = parse_ansi(colors, default_fg, default_bg, [&](sf::Color bgcolor, sf::Color color, char ch) {
|
||||
bool good = parse_ansi(colors_utf8, default_fg, default_bg, [&](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