|
|
|
|
@ -35,13 +35,17 @@ void Slide::init(lel::Cell& cell) { |
|
|
|
|
"[_|_|_]"); |
|
|
|
|
|
|
|
|
|
auto title = $gui.entity("title"); |
|
|
|
|
$gui.set<guecs::Text>(title, {$title, TITLE_SIZE}); |
|
|
|
|
guecs::Text title_text{$title, TITLE_SIZE}; |
|
|
|
|
config_text(title_text); |
|
|
|
|
$gui.set<guecs::Text>(title, title_text); |
|
|
|
|
|
|
|
|
|
auto content = $gui.entity("content"); |
|
|
|
|
$gui.set<guecs::Text>(content, { |
|
|
|
|
guecs::Text content_text{ |
|
|
|
|
$content, |
|
|
|
|
CONTENT_SIZE, |
|
|
|
|
guecs::THEME.TEXT_COLOR, 20}); |
|
|
|
|
guecs::THEME.TEXT_COLOR, 20}; |
|
|
|
|
config_text(content_text); |
|
|
|
|
$gui.set<guecs::Text>(content, content_text); |
|
|
|
|
|
|
|
|
|
if($config.contains("image")) { |
|
|
|
|
$gui.set<guecs::Sprite>(content, {$config["image"]}); |
|
|
|
|
@ -51,6 +55,24 @@ void Slide::init(lel::Cell& cell) { |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void Slide::config_text(guecs::Text &result) { |
|
|
|
|
if($config.contains("font_size")) result.size = $config["font_size"]; |
|
|
|
|
|
|
|
|
|
if($config.contains("font_color")) { |
|
|
|
|
std::vector<uint8_t> color = $config["font_color"]; |
|
|
|
|
|
|
|
|
|
dbc::check(color.size() == 4, "font_color on slide must have 4 values rgba"); |
|
|
|
|
|
|
|
|
|
fmt::println("font_color is {},{},{},{}", color[0], color[1], color[2], color[3]); |
|
|
|
|
result.color = sf::Color{ |
|
|
|
|
color[0], color[1], color[2], color[3]}; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if($config.contains("font_padding")) result.padding = $config["font_padding"]; |
|
|
|
|
|
|
|
|
|
if($config.contains("font_centered")) result.centered = $config["font_centered"]; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void Slide::render(sf::RenderWindow& window) { |
|
|
|
|
$gui.render(window); |
|
|
|
|
// $gui.debug_layout(window);
|
|
|
|
|
|