38 const Player* comparison =
nullptr,
float height = 0.0f)
41 const float dpi = ImGui::GetStyle().FontScaleDpi;
50 ImGui::PushStyleColor(ImGuiCol_Text, palette.
muted);
51 ImGui::TextWrapped(
"%s",
LOC(
"PLAYER_SELECT_PROMPT"));
52 ImGui::PopStyleColor();
57 const double overall = player->
getOverall(statsConfig);
62 ImGui::TextUnformatted(player->
getName().c_str());
64 ImGui::PushStyleColor(ImGuiCol_Text, palette.
muted);
69 :
LOC(
"PLAYER_FOOT_LEFT"));
70 ImGui::PopStyleColor();
72 const float keyWidth = 130.0f * dpi;
80 ImGui::PopStyleColor();
84 const double delta = overall - comparison->getOverall(statsConfig);
86 "%s: %+.1f",
LOC(
"PLAYER_OVERALL_CHANGE"), delta);
87 if (player->
getRole() == comparison->getRole())
89 ImGui::TextColored(palette.
positive,
"%s",
LOC(
"PLAYER_ROLE_MATCH"));
93 ImGui::TextColored(palette.
warning,
"%s: %s -> %s",
94 LOC(
"PLAYER_ROLE_CHANGE"),
102 const float labelWidth = 100.0f * dpi;
111 const auto other = comparison->getStats().find(
name);
113 value - (other != comparison->getStats().end() ? other->second : 0.0f);
114 const std::string deltaText = std::format(
"{:+.0f}", delta);
115 const float deltaWidth = ImGui::CalcTextSize(
"+00").x;
116 const float rowStart = ImGui::GetCursorPosX();
117 const float available = ImGui::GetContentRegionAvail().x;
120 ImGui::SameLine(rowStart + available - deltaWidth);
122 "%s", deltaText.c_str());
Persistent career identity, attributes, traits and day-to-day state.
Definition player.h:104
Foot getFoot() const
Gets the player's preferred foot.
Definition player.cpp:93
uint32_t getWage() const
Gets the player's wage.
Definition player.cpp:71
PlayerRole getRole() const
Gets the player's role.
Definition player.cpp:67
uint8_t getHeight() const
Gets the player's height.
Definition player.cpp:91
int getAge() const
Gets the player's age.
Definition player.cpp:59
std::string getName() const
Gets the player's full name.
Definition player.cpp:53
uint8_t getContractYears() const
Gets the player's remaining contract years.
Definition player.cpp:75
double getOverall(const StatsConfig &stats_config) const
Calculates the player's overall rating based on stats and configuration.
Definition player.cpp:105
const std::map< std::string, float > & getStats() const
Gets the player's stats map.
Definition player.cpp:97
static const char * shortName(PlayerRole role)
Localised short position name for display ("GK", "POR"). The codes of toString() are for persistence ...
Definition role_utils.cpp:35
static const char * longName(PlayerRole role)
Localised full position name ("Goalkeeper", "Portiere").
Definition role_utils.cpp:41
Pushes a typography level for the lifetime of the object.
Definition theme.h:176
#define LOC(key)
Global helper macro for concise UI code localization.
Definition language_manager.h:130
Definition player_ui.h:27
void detailPanel(const char *id, const Player *player, const StatsConfig &statsConfig, const Player *comparison=nullptr, float height=0.0f)
Compact player card used beside tables (squad, lineup, subs).
Definition player_ui.h:36
std::string statLabel(std::string_view statName)
Localised name of a player attribute (falls back to the raw name).
Definition player_view.cpp:131
constexpr float XS
Definition theme.h:33
constexpr float S
Definition theme.h:34
const Palette & palette()
Returns the active palette (accent included).
Definition theme.cpp:374
void ratingChip(double rating)
Rounded rating chip, coloured by the rating scale.
Definition widgets.cpp:311
void sectionLabel(const char *text)
Small uppercase section label.
Definition widgets.cpp:121
void beginCard(const char *id, const char *title, ImVec2 size, bool scroll)
Starts a bordered card. Always pair with endCard().
Definition widgets.cpp:152
void beginAutoHeightCard(const char *id, const char *title, float width)
Starts a card that grows to fit its content (never scrolls).
Definition widgets.cpp:160
void endCard()
Ends a card started with beginCard() or beginAutoHeightCard().
Definition widgets.cpp:166
void keyValue(const char *key, const char *value, float keyWidth)
Muted key on the left, value on the right of the current row.
Definition widgets.cpp:1235
void attributeBar(const char *label, float value, float labelWidth, float maxValue, float width)
Labelled horizontal bar coloured with the rating scale.
Definition widgets.cpp:292
Contains structures to simplify JSON parsing and loading of player statistics.
Configuration mapping roles to their focus areas and listing all possible stats.
Definition stats_config.h:42
Semantic colours used by widgets.
Definition theme.h:90
ImVec4 muted
Definition theme.h:97
ImVec4 text
Definition theme.h:96
ImVec4 negative
Definition theme.h:101
ImVec4 warning
Definition theme.h:100
ImVec4 positive
Definition theme.h:99