Files
Tower-Defense/src/render/gui/MobTooltip.cpp
2021-11-21 17:02:42 +01:00

43 lines
1.4 KiB
C++

#include "render/gui/MobTooltip.h"
#include "render/gui/imgui/imgui.h"
#include "render/WorldRenderer.h"
#include "game/Mobs.h"
#include "game/client/Client.h"
namespace td {
namespace gui {
MobTooltip::MobTooltip(client::Client* client) : GuiWidget(client) {
}
void MobTooltip::render() {
if (m_Mob == nullptr) return;
const game::Player& sender = getClient()->getGame().getPlayerById(m_Mob->getSender());
ImGui::BeginTooltip();
ImGui::Text("Sender :");
ImGui::SameLine();
ImGui::PushStyleColor(ImGuiCol_Text, render::WorldRenderer::getImGuiTeamColor(sender.getTeamColor()));
ImGui::Text("%s", sender.getName().c_str());
ImGui::PopStyleColor();
ImGui::Text("Mob HP : %.1f/%i", m_Mob->getHealth(), m_Mob->getStats()->getMaxLife());
ImGui::Text("Mob Type : %s", game::MobFactory::getMobName(m_Mob->getType()).c_str());
ImGui::Text("Mob Level : %i", m_Mob->getLevel());
ImGui::NewLine();
ImGui::Text("Mob Stats :");
ImGui::Text("\tMax health : %i", m_Mob->getStats()->getMaxLife());
ImGui::Text("\tSpeed : %.1f", m_Mob->getStats()->getMovementSpeed());
ImGui::Text("\tDamage : %.1f", m_Mob->getStats()->getDamage());
ImGui::Text("\tMoney cost : %i", m_Mob->getStats()->getMoneyCost());
ImGui::Text("\tEXP cost : %i", m_Mob->getStats()->getExpCost());
ImGui::Text("\tEXP reward : %i", m_Mob->getStats()->getExpReward());
ImGui::EndTooltip();
}
} // namespace gui
} // namespace td