#include "client/render/gui/CastleTooltip.h"
#include "client/render/gui/imgui/imgui.h"
#include "client/render/gui/LifeProgress.h"
#include "client/render/gui/ImGuiTeamColor.h"

#include "client/render/WorldRenderer.h"

#include "client/Client.h"

namespace td {
namespace gui {

CastleTooltip::CastleTooltip(client::Client* client) : GuiWidget(client) {

}

void CastleTooltip::Render() {
	if (m_Castle == nullptr) return;

	if (ImGui::GetIO().KeyShift) {
		ImGui::BeginTooltip();
		ImGui::PushStyleColor(ImGuiCol_Text, render::GetImGuiTeamColor(m_Castle->GetTeam()->GetColor()));
		ImGui::Text("Castle : ");
		ImGui::PopStyleColor();
		ImGui::Text("\tCastle HP : %i/%i", static_cast<int>(m_Castle->GetLife()), game::TeamCastle::CastleMaxLife);
		ImGui::EndTooltip();
	} else {
		ImGui::BeginTooltip();
		RenderLifeProgress(m_Castle->GetLife() / static_cast<float>(game::TeamCastle::CastleMaxLife));
		ImGui::EndTooltip();
	}
}

} // namespace gui
} // namespace td
