Packets Refactor

commit 497a601c424e8e728ef0a8e61f049982f2d4af16
Author: Persson-dev <sim16.prib@gmail.com>
Date:   Sat Aug 12 10:32:52 2023 +0200

    fix warning

commit 1bfd019a1ea00dcdb6323d1f285e2cdd3ebb4020
Author: Persson-dev <sim16.prib@gmail.com>
Date:   Tue Jul 25 19:05:13 2023 +0200

    refactor: update cast

commit 5bbc23a7d37e53eb74a885685f18e714f9448fd9
Author: Persson-dev <sim16.prib@gmail.com>
Date:   Tue Jul 25 19:04:15 2023 +0200

    moved GetImguiTeamColor

commit fd0e2d2470ea5cca3553acf280aa371de5c06f4c
Author: Persson-dev <sim16.prib@gmail.com>
Date:   Tue Jul 25 19:03:37 2023 +0200

    packets forward declaration

commit 06eb9b99a96731f4b9a2167c00ed0bcd03702e3b
Author: Persson-dev <sim16.prib@gmail.com>
Date:   Tue Jul 25 18:30:55 2023 +0200

    remove Protocol.h includes

commit 165f63d2e8b468f3e38992baddc221270010f801
Author: Persson-dev <sim16.prib@gmail.com>
Date:   Tue Jul 25 18:30:30 2023 +0200

    split packets into separate source files

commit f247f146c6c1e804a44b86f65cf3059859c07c6c
Author: Persson-dev <sim16.prib@gmail.com>
Date:   Tue Jul 25 17:45:24 2023 +0200

    split packets into separate headers
This commit is contained in:
2023-08-12 10:41:39 +02:00
parent 36f37b6548
commit f941862637
76 changed files with 1734 additions and 1152 deletions

View File

@@ -11,18 +11,6 @@
namespace td {
namespace render {
ImVec4 WorldRenderer::GetImGuiTeamColor(game::TeamColor color) {
switch (color) {
case td::game::TeamColor::None:
break;
case td::game::TeamColor::Red:
return ImVec4(1, 0, 0, 1);
case td::game::TeamColor::Blue:
return ImVec4(0, 0, 1, 1);
}
return ImVec4(1, 1, 1, 1);
}
void WorldRenderer::LoadModels() {
utils::LOGD("World Created !");
m_WorldVao = std::make_unique<GL::VertexArray>(std::move(WorldLoader::LoadWorldModel(m_World)));

View File

@@ -1,6 +1,7 @@
#include "render/gui/CastleTooltip.h"
#include "render/gui/imgui/imgui.h"
#include "render/gui/LifeProgress.h"
#include "render/gui/ImGuiTeamColor.h"
#include "render/WorldRenderer.h"
@@ -18,7 +19,7 @@ void CastleTooltip::Render() {
if (ImGui::GetIO().KeyShift) {
ImGui::BeginTooltip();
ImGui::PushStyleColor(ImGuiCol_Text, render::WorldRenderer::GetImGuiTeamColor(m_Castle->GetTeam()->GetColor()));
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);

View File

@@ -1,5 +1,6 @@
#include "render/gui/GameMenu.h"
#include "render/gui/imgui/imgui.h"
#include "render/gui/ImGuiTeamColor.h"
#include "render/WorldRenderer.h"
@@ -43,7 +44,7 @@ void GameMenu::ShowPlayers() {
if (ImGui::TreeNode(std::string("Players (" + std::to_string(GetClient()->GetGame().GetPlayers().size()) + ")##player_list").c_str())) {
for (auto pair : GetClient()->GetGame().GetPlayers()) {
const td::game::Player& player = pair.second;
ImGui::PushStyleColor(ImGuiCol_Text, render::WorldRenderer::GetImGuiTeamColor(player.GetTeamColor()));
ImGui::PushStyleColor(ImGuiCol_Text, render::GetImGuiTeamColor(player.GetTeamColor()));
ImGui::Text("%s", player.GetName().c_str());
ImGui::PopStyleColor();
}

View File

@@ -0,0 +1,19 @@
#include "render/gui/ImGuiTeamColor.h"
namespace td {
namespace render {
ImVec4 GetImGuiTeamColor(game::TeamColor color) {
switch (color) {
case td::game::TeamColor::None:
break;
case td::game::TeamColor::Red:
return ImVec4(1, 0, 0, 1);
case td::game::TeamColor::Blue:
return ImVec4(0, 0, 1, 1);
}
return ImVec4(1, 1, 1, 1);
}
} // namespace render
} // namespace td

View File

@@ -1,6 +1,7 @@
#include "render/gui/MobTooltip.h"
#include "render/gui/imgui/imgui.h"
#include "render/gui/LifeProgress.h"
#include "render/gui/ImGuiTeamColor.h"
#include "render/WorldRenderer.h"
@@ -25,7 +26,7 @@ void MobTooltip::Render() {
ImGui::BeginTooltip();
ImGui::Text("Sender :");
ImGui::SameLine();
ImGui::PushStyleColor(ImGuiCol_Text, render::WorldRenderer::GetImGuiTeamColor(sender->GetTeamColor()));
ImGui::PushStyleColor(ImGuiCol_Text, render::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());