MCPcopy Create free account
hub / github.com/EasyRPG/Player / DrawItem

Method DrawItem

src/window_skill.cpp:74–91  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

72}
73
74void Window_Skill::DrawItem(int index) {
75 Rect rect = GetItemRect(index);
76 contents->ClearRect(rect);
77
78 int skill_id = data[index];
79
80 if (skill_id > 0) {
81 int costs = actor->CalculateSkillCost(skill_id);
82
83 bool enabled = CheckEnable(skill_id);
84 int color = !enabled ? Font::ColorDisabled : Font::ColorDefault;
85
86 contents->TextDraw(rect.x + rect.width - 24, rect.y, color, fmt::format("{}{:3d}", lcf::rpg::Terms::TermOrDefault(lcf::Data::terms.easyrpg_skill_cost_separator, "-"), costs));
87
88 // Skills are guaranteed to be valid
89 DrawSkillName(*lcf::ReaderUtil::GetElement(lcf::Data::skills, skill_id), rect.x, rect.y, enabled);
90 }
91}
92
93void Window_Skill::UpdateHelp() {
94 help_window->SetText(GetSkill() == nullptr ? "" : ToString(GetSkill()->description));

Callers

nothing calls this directly

Calls 3

ClearRectMethod · 0.80
TextDrawMethod · 0.80
CalculateSkillCostMethod · 0.45

Tested by

no test coverage detected