#pragma once

#include "../../entity.hpp"
#include "../../render/canvas.hpp"
#include "../../resources.hpp"

#include <imgui.h>

namespace game::util::imgui::widget
{
  class EntityCanvas
  {
  public:
    Canvas canvas{};
    glm::vec4 rect{NAN};
    ImVec2 imageSize{};
    float scale{};

    void clear();
    ImVec2 shake_offset_get() const;
    Canvas& render(Resources&, Entity&, ImVec2, float maxScale = 0.0f);
    Canvas& render_rotated(Resources&, Entity&, ImVec2, float rotation, float maxScale = 0.0f);

  private:
    Canvas& render(Resources&, Entity&, ImVec2, float maxScale, const float* rotation);
  };
}
