summaryrefslogtreecommitdiffhomepage
path: root/Icons.cpp
diff options
context:
space:
mode:
authorAki <please@ignore.pl>2022-06-09 20:08:22 +0200
committerAki <please@ignore.pl>2022-06-09 20:08:22 +0200
commite0de78eecfbc8898b028f191326e87f647d6aa5b (patch)
tree1041ba51f7a5638d5bc84bcdf5c48cd8f59443d1 /Icons.cpp
parentb08f360cf92e76fabf5b762bf79032f60f751e30 (diff)
downloadderelict-e0de78eecfbc8898b028f191326e87f647d6aa5b.zip
derelict-e0de78eecfbc8898b028f191326e87f647d6aa5b.tar.gz
derelict-e0de78eecfbc8898b028f191326e87f647d6aa5b.tar.bz2
Added group icons to wreck labels
Diffstat (limited to 'Icons.cpp')
-rw-r--r--Icons.cpp31
1 files changed, 30 insertions, 1 deletions
diff --git a/Icons.cpp b/Icons.cpp
index a903e19..f08787f 100644
--- a/Icons.cpp
+++ b/Icons.cpp
@@ -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;
+}