28 const lgfx::IFont *font_;
37 void setText(
const std::string &text)
41 void draw(M5Canvas &canvas)
override
48 if (text_.length() == 0)
53 uint16_t primaryColor = canvas.getColorDepth() == 1
55 : cp.get(DrawingLocation::kBalloonForeground);
56 uint16_t backgroundColor = canvas.getColorDepth() == 1
58 : cp.get(DrawingLocation::kBalloonBackground);
59 M5.Lcd.setTextSize(TEXT_SIZE);
60 M5.Lcd.setTextDatum(MC_DATUM);
61 canvas.setTextSize(TEXT_SIZE);
62 canvas.setTextColor(primaryColor, backgroundColor);
63 canvas.setTextDatum(MC_DATUM);
64 M5.Lcd.setFont(font_);
65 int textWidth = M5.Lcd.textWidth(text_.c_str());
66 int textHeight = TEXT_HEIGHT * TEXT_SIZE;
67 canvas.fillEllipse(cx - 20, cy, textWidth + 2, textHeight * 2 + 2,
69 canvas.fillTriangle(cx - 62, cy - 42, cx - 8, cy - 10, cx - 41, cy - 8,
71 canvas.fillEllipse(cx - 20, cy, textWidth, textHeight * 2,
73 canvas.fillTriangle(cx - 60, cy - 40, cx - 10, cy - 10, cx - 40, cy - 10,
75 canvas.drawString(text_.c_str(), cx - textWidth / 6 - 15, cy, font_);