#include "gui/scene_ui.hpp"
#include "game/config.hpp"


namespace gui {
  void SceneUI::init() {
    $view_sprite.setPosition({0,0});
    $scene.init();
  }

  void SceneUI::render(sf::RenderTarget &target) {
    $scene.render($view_texture);
    target.draw($view_sprite);
  }

  void SceneUI::update() {
    $scene.update();
  }

  bool SceneUI::mouse(float x, float y, guecs::Modifiers mods) {
    $scene.mouse(x, y, mods);
    return false;
  }

  AnimatedScene SceneUI::load_scene(const std::string& name) {
    auto scene_config = settings::get("scenes")[name];
    return components::convert<AnimatedScene>(scene_config);
  }
}
