This commit is contained in:
2025-08-23 12:54:48 +02:00
parent 73dd2dabfa
commit 1d436aa1c3
12 changed files with 93 additions and 24 deletions

View File

@@ -1,18 +1,29 @@
#include <td/render/renderer/PlayerListRenderer.h>
#include <imgui.h>
#include <iostream>
#include <optional>
namespace td {
namespace render {
void PlayerListRenderer::Render(float a_Lerp) {
ImGui::Begin("Players");
if (ImGui::Button("Add player")) {
OnPlayerCreate();
}
std::optional<PlayerID> kick;
for (const auto& [id, player] : m_Players) {
ImGui::PushID(id);
ImGui::Text("[%i] %s", id, player.m_PlayerName.c_str());
ImGui::SameLine();
if (ImGui::Button("Kick")){
kick = id;
}
ImGui::PopID();
}
ImGui::End();
if (kick.has_value())
OnPlayerKick(*kick);
}
PlayerListRenderer::PlayerListRenderer(const client::PlayerManager& a_Players) : m_Players(a_Players) {}