MCPcopy Create free account
hub / github.com/crosspoint-reader/crosspoint-reader / drawBatteryLeft

Method drawBatteryLeft

src/components/themes/BaseTheme.cpp:101–114  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

99}
100
101void BaseTheme::drawBatteryLeft(const GfxRenderer& renderer, Rect rect, const bool showPercentage) const {
102 // Left aligned: icon on left, percentage on right (reader mode)
103 const uint16_t percentage = powerManager.getBatteryPercentage();
104 const int y = rect.y + 6;
105
106 if (showPercentage) {
107 const auto percentageText = std::to_string(percentage) + "%";
108 renderer.drawText(SMALL_FONT_ID, rect.x + batteryPercentSpacing + rect.width, rect.y, percentageText.c_str());
109 }
110
111 const Rect iconRect{rect.x, y, rect.width, rect.height};
112 drawBatteryOutline(renderer, rect.x, y, rect.width, rect.height);
113 fillBatteryIcon(renderer, iconRect, percentage);
114}
115
116void BaseTheme::drawBatteryRight(const GfxRenderer& renderer, Rect rect, const bool showPercentage) const {
117 // Right aligned: percentage on left, icon on right (UI headers)

Callers 1

drawStatusBarMethod · 0.80

Calls 2

getBatteryPercentageMethod · 0.80
drawTextMethod · 0.80

Tested by

no test coverage detected