#pragma once #include #include #include "textures.hpp" #include #include #include "camera.hpp" #include #include "animate2.hpp" #include "components.hpp" namespace scene { using std::shared_ptr; using namespace textures; struct Element { std::string name; textures::SpriteTexture st; animate2::Animate2 anim; std::string cell; sf::Vector2f scale{1.0f, 1.0f}; sf::Vector2f pos{0.0f, 0.0f}; bool at_mid=false; bool flipped=false; std::shared_ptr effect = nullptr; sf::Text text; }; struct Engine { sf::Clock $clock; guecs::UI $ui; components::AnimatedScene& $scene; std::string $layout; std::unordered_map $actor_name_ids; std::vector $fixtures; std::vector $actors; cinematic::Camera $camera{{BOSS_VIEW_WIDTH, BOSS_VIEW_HEIGHT}}; Engine(components::AnimatedScene& scene); void init(); void render(sf::RenderTexture& view); bool mouse(float x, float y, guecs::Modifiers mods); void attach_text(const std::string& actor, const std::string& text); Element config_scene_element(nlohmann::json& config, bool duped); sf::Vector2f position_sprite(textures::SpriteTexture& st, const std::string& cell_name, sf::Vector2f scale, bool at_mid, float x_diff=0.0f, float y_diff=0.0f); void move_actor(const std::string& actor, const std::string& cell_name); void animate_actor(const std::string& actor, const std::string& form); void play_animations(); void apply_effect(const std::string& actor, const std::string& shader); Element& actor_config(const std::string& actor); void zoom(const std::string& actor, const std::string& style, float scale=0.9f); void zoom(float mid_x, float mid_y, const std::string& style, float scale); void reset(sf::RenderTexture& view); void set_end_cb(std::function cb); void tick(); }; }