diff options
Diffstat (limited to 'Icons.cpp')
-rw-r--r-- | Icons.cpp | 31 |
1 files changed, 30 insertions, 1 deletions
@@ -2,6 +2,7 @@ #include <string> #include <unordered_map> +#include <utility> #include <raylib.h> @@ -31,7 +32,8 @@ static const std::unordered_map<long int, std::string> 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; +} |