Files
lilygo-t5-template/src/ui/views/battery_view.h
Кобелев Андрей Андреевич 6253480f30 Дисплей
2026-03-12 00:40:06 +03:00

30 lines
645 B
C++

#pragma once
#include "epdiy.h"
namespace ui {
struct BatteryProps {
bool valid;
int percent;
};
class BatteryView {
public:
void layout(int screen_width, int screen_height);
EpdRect dirty_bounds(const BatteryProps& props, int pad_x = 4, int pad_y = 4) const;
void render(uint8_t* framebuffer, const BatteryProps& props);
const EpdRect& bounds() const;
private:
EpdRect measure_text_bounds(const BatteryProps& props) const;
EpdRect bounds_ = {0, 0, 0, 0};
int text_x_ = 0;
int text_y_ = 0;
EpdRect last_text_bounds_ = {0, 0, 0, 0};
bool has_last_text_bounds_ = false;
};
} // namespace ui