refactor: consolidate UI colors, quality colors, and renderCoinsText

Create shared include/ui/ui_colors.hpp with common ImGui color constants,
item quality color lookup, and renderCoinsText utility. Remove 3 duplicate
renderCoinsText implementations and 3 duplicate quality color switch
blocks across game_screen, inventory_screen, and quest_log_screen.
This commit is contained in:
Kelsi 2026-03-25 12:27:43 -07:00
parent eea205ffc9
commit 4d46641ac2
4 changed files with 71 additions and 82 deletions

View file

@ -1,4 +1,5 @@
#include "ui/quest_log_screen.hpp"
#include "ui/ui_colors.hpp"
#include "ui/inventory_screen.hpp"
#include "ui/keybinding_manager.hpp"
#include "core/application.hpp"
@ -215,20 +216,6 @@ std::string cleanQuestTitleForUi(const std::string& raw, uint32_t questId) {
return s;
}
void renderCoinsText(uint32_t g, uint32_t s, uint32_t c) {
bool any = false;
if (g > 0) {
ImGui::TextColored(ImVec4(1.00f, 0.82f, 0.00f, 1.0f), "%ug", g);
any = true;
}
if (s > 0 || g > 0) {
if (any) ImGui::SameLine(0, 3);
ImGui::TextColored(ImVec4(0.80f, 0.80f, 0.80f, 1.0f), "%us", s);
any = true;
}
if (any) ImGui::SameLine(0, 3);
ImGui::TextColored(ImVec4(0.72f, 0.45f, 0.20f, 1.0f), "%uc", c);
}
} // anonymous namespace
void QuestLogScreen::render(game::GameHandler& gameHandler, InventoryScreen& invScreen) {