|
|
|
@ -180,7 +180,7 @@ void SFMLRender::render_text(const std::wstring &text, float start_x, float star |
|
|
|
|
$ui_text.setFillColor($default_fg); |
|
|
|
|
|
|
|
|
|
$ansi.parse(text, |
|
|
|
|
[&](sf::Color fg, sf::Color bg){ |
|
|
|
|
[&](sf::Color fg, sf::Color bg) { |
|
|
|
|
if(out.size() > 0 ) { |
|
|
|
|
auto bounds = draw_chunk($window, $ui_bounds, $ui_text, bgcolor, x, y, out); |
|
|
|
|
x += bounds.width; |
|
|
|
@ -216,28 +216,26 @@ void SFMLRender::render_text(const std::wstring &text, float start_x, float star |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void SFMLRender::draw_text(Panel &panel) { |
|
|
|
|
sf::RectangleShape backing( |
|
|
|
|
sf::Vector2f($ui_bounds.width * panel.width + panel.border_px, |
|
|
|
|
$ui_bounds.height * panel.height + panel.border_px)); |
|
|
|
|
|
|
|
|
|
backing.setFillColor(panel.default_bg); |
|
|
|
|
void SFMLRender::draw(Panel &panel, float x_offset, float y_offset) { |
|
|
|
|
panel.render(); |
|
|
|
|
const std::wstring &panelout = panel.to_string(); |
|
|
|
|
|
|
|
|
|
if(panel.has_border) { |
|
|
|
|
backing.setOutlineColor(panel.border_color); |
|
|
|
|
backing.setOutlineThickness(panel.border_px); |
|
|
|
|
} |
|
|
|
|
if(panel.grid) { |
|
|
|
|
render_grid(panelout, panel.x + x_offset, panel.y + y_offset); |
|
|
|
|
} else { |
|
|
|
|
sf::RectangleShape backing( |
|
|
|
|
sf::Vector2f($ui_bounds.width * panel.width + panel.border_px, |
|
|
|
|
$ui_bounds.height * panel.height + panel.border_px)); |
|
|
|
|
|
|
|
|
|
backing.setPosition(panel.x, panel.y); |
|
|
|
|
$window.draw(backing); |
|
|
|
|
backing.setFillColor(panel.default_bg); |
|
|
|
|
|
|
|
|
|
panel.render(); |
|
|
|
|
const std::wstring &panelout = panel.to_string(); |
|
|
|
|
render_text(panelout, panel.x, panel.y); |
|
|
|
|
} |
|
|
|
|
if(panel.has_border) { |
|
|
|
|
backing.setOutlineColor(panel.border_color); |
|
|
|
|
backing.setOutlineThickness(panel.border_px); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void SFMLRender::draw_grid(Panel &panel, float x, float y) { |
|
|
|
|
panel.render(); |
|
|
|
|
const std::wstring &panelout = panel.to_string(); |
|
|
|
|
render_grid(panelout, panel.x + x, panel.y + y); |
|
|
|
|
backing.setPosition(panel.x + x_offset, panel.y + y_offset); |
|
|
|
|
$window.draw(backing); |
|
|
|
|
render_text(panelout, panel.x, panel.y); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|