From e0de78eecfbc8898b028f191326e87f647d6aa5b Mon Sep 17 00:00:00 2001 From: Aki Date: Thu, 9 Jun 2022 20:08:22 +0200 Subject: Added group icons to wreck labels --- Icons.cpp | 31 ++++++++++++++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-) (limited to 'Icons.cpp') diff --git a/Icons.cpp b/Icons.cpp index a903e19..f08787f 100644 --- a/Icons.cpp +++ b/Icons.cpp @@ -2,6 +2,7 @@ #include #include +#include #include @@ -31,7 +32,8 @@ static const std::unordered_map FILENAMES { Icons::Icons() : - m_cache {} + m_cache {}, + m_teams {} { } @@ -48,6 +50,25 @@ Icons::reset() for (const auto& [_, texture] : m_cache) UnloadTexture(texture); m_cache.clear(); + for (const auto& texture : m_teams) + UnloadRenderTexture(texture); + m_teams.clear(); +} + + +void +Icons::draw_team_icons() +{ + if (!m_teams.empty()) + return; + m_teams.reserve(2); + for (const auto color : {Color{204, 8, 153, 255}, Color{20, 234, 106, 255}}) { + auto texture = LoadRenderTexture(6, 6); + BeginTextureMode(texture); + DrawRectangle(0, 0, 6, 6, color); + EndTextureMode(); + m_teams.push_back(std::move(texture)); + } } @@ -68,3 +89,11 @@ Icons::find(const long int group) return texture; } } + + +Texture2D +Icons::team_icon(const int team) +{ + auto& render = m_teams.at(team); + return render.texture; +} -- cgit v1.1