|
|
|
@ -18,12 +18,12 @@ Slide::Slide(const string& title, const string& content, json& config, json& dec |
|
|
|
$config(config) |
|
|
|
$config(config) |
|
|
|
{ |
|
|
|
{ |
|
|
|
// first config the text with any font stuff from the deck
|
|
|
|
// first config the text with any font stuff from the deck
|
|
|
|
config_text($title_font, deck_config); |
|
|
|
config_text($title_font, deck_config, "title"); |
|
|
|
config_text($content_font, deck_config); |
|
|
|
config_text($content_font, deck_config, "font"); |
|
|
|
|
|
|
|
|
|
|
|
// then config it with the slide's config
|
|
|
|
// then config it with the slide's config
|
|
|
|
config_text($title_font, $config); |
|
|
|
config_text($title_font, $config, "title"); |
|
|
|
config_text($content_font, $config); |
|
|
|
config_text($content_font, $config, "font"); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void Slide::init(lel::Cell& cell, const std::string& layout) { |
|
|
|
void Slide::init(lel::Cell& cell, const std::string& layout) { |
|
|
|
@ -50,11 +50,11 @@ void Slide::init(lel::Cell& cell, const std::string& layout) { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void Slide::config_text(guecs::Text &result, nlohmann::json& config) { |
|
|
|
void Slide::config_text(guecs::Text &result, nlohmann::json& config, std::string prefix) { |
|
|
|
if(config.contains("font_size")) result.size = config["font_size"]; |
|
|
|
if(config.contains(prefix + "_size")) result.size = config[prefix + "_size"]; |
|
|
|
|
|
|
|
|
|
|
|
if(config.contains("font_color")) { |
|
|
|
if(config.contains(prefix + "_color")) { |
|
|
|
std::vector<uint8_t> color = config["font_color"]; |
|
|
|
std::vector<uint8_t> color = config[prefix + "_color"]; |
|
|
|
|
|
|
|
|
|
|
|
dbc::check(color.size() == 4, "font_color on slide must have 4 values rgba"); |
|
|
|
dbc::check(color.size() == 4, "font_color on slide must have 4 values rgba"); |
|
|
|
|
|
|
|
|
|
|
|
@ -63,9 +63,9 @@ void Slide::config_text(guecs::Text &result, nlohmann::json& config) { |
|
|
|
color[0], color[1], color[2], color[3]}; |
|
|
|
color[0], color[1], color[2], color[3]}; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if(config.contains("font_padding")) result.padding = config["font_padding"]; |
|
|
|
if(config.contains(prefix + "_padding")) result.padding = config[prefix + "_padding"]; |
|
|
|
|
|
|
|
|
|
|
|
if(config.contains("font_centered")) result.centered = config["font_centered"]; |
|
|
|
if(config.contains(prefix + "_centered")) result.centered = config[prefix + "_centered"]; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void Slide::render(sf::RenderWindow& window) { |
|
|
|
void Slide::render(sf::RenderWindow& window) { |
|
|
|
|