MCPcopy Create free account
hub / github.com/diasurgical/DevilutionX / DrawFlaskValues

Function DrawFlaskValues

Source/control.cpp:813–826  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

811}
812
813void DrawFlaskValues(const Surface &out, Point pos, int currValue, int maxValue)
814{
815 UiFlags color = (currValue > 0 ? (currValue == maxValue ? UiFlags::ColorGold : UiFlags::ColorWhite) : UiFlags::ColorRed);
816
817 auto drawStringWithShadow = [out, color](string_view text, Point pos) {
818 DrawString(out, text, pos + Displacement { -1, -1 }, { UiFlags::ColorBlack | UiFlags::KerningFitSpacing, 0 });
819 DrawString(out, text, pos, { color | UiFlags::KerningFitSpacing, 0 });
820 };
821
822 std::string currText = StrCat(currValue);
823 drawStringWithShadow(currText, pos - Displacement { GetLineWidth(currText, GameFont12) + 1, 0 });
824 drawStringWithShadow("/", pos);
825 drawStringWithShadow(StrCat(maxValue), pos + Displacement { GetLineWidth("/", GameFont12) + 1, 0 });
826}
827
828void control_update_life_mana()
829{

Callers 1

DrawAndBlitFunction · 0.85

Calls 3

StrCatFunction · 0.85
GetLineWidthFunction · 0.85
DrawStringFunction · 0.50

Tested by

no test coverage detected