#pragma once #include #include #include #include #include "constants.hpp" struct Slide { guecs::UI $gui; std::wstring $title; std::wstring $content; nlohmann::json $config; bool $initialized = false; guecs::Text $content_font{$content, CONTENT_SIZE, guecs::THEME.TEXT_COLOR, 20}; guecs::Text $title_font{$title, TITLE_SIZE}; std::shared_ptr $shader = nullptr; Slide(const std::string& title, const std::string& content, nlohmann::json& config, nlohmann::json& deck_config); Slide() {} void init(lel::Cell& cell, const std::string& layout); void render(sf::RenderTarget& view); void config_text(guecs::Text &result, nlohmann::json& config, std::string prefix); }; using SlideSet = std::vector; struct SlideDeck { nlohmann::json config; SlideSet slides; size_t current = 0; bool at_end(); Slide& current_slide(); Slide& preview_slide(); void next_slide(); void prev_slide(); void set_slide(size_t index); }; struct SlidesUI { guecs::UI $gui; std::shared_ptr $deck = nullptr; std::unordered_map $layouts; sf::RenderTexture $view_texture; sf::Sprite $view_sprite; sf::Clock $clock; SlidesUI(std::shared_ptr deck, sf::Vector2u size); void init(); Slide& current_slide(); void next_slide(); void prev_slide(); void show_slide(); void set_slide(size_t index); void render(sf::RenderTarget& window); void mouse(float x, float y, guecs::Modifiers mods); void set_text(const std::string& name); void handle_events(sf::RenderWindow& presenter, const sf::Event& event); void configure_layouts(); };