#include "entity_button.hpp"

#include "widget.hpp"

namespace game::util::imgui::widget
{
  void EntityButton::clear() { canvas.clear(); }

  Canvas& EntityButton::canvas_get(Resources& resources, Entity& entity, ImVec2 size)
  {
    return canvas.render(resources, entity, size);
  }

  bool EntityButton::button(Resources& resources, Entity& entity, const char* id, ImVec2 size, ImVec4 tint)
  {
    auto& entityCanvas = canvas_get(resources, entity, size);
    auto result = ImGui::ImageButton(id, entityCanvas.texture, size, ImVec2(), ImVec2(1, 1), ImVec4(), tint);
    fx();
    return result;
  }
}
