diff --git a/lib/image/image.cpp b/lib/image/image.cpp index 746a6e0..6aa0e2e 100644 --- a/lib/image/image.cpp +++ b/lib/image/image.cpp @@ -23,43 +23,35 @@ void timeOverlay(OLEDDisplay *display, OLEDDisplayUiState* state) { display->setTextAlignment(TEXT_ALIGN_CENTER); display->drawString(64, 54, time); - display->setTextAlignment(TEXT_ALIGN_LEFT); } // frames int frameCount = 3; FrameCallback frames[] = { oledWebFrame, oledBilibiliFrame, oledOsFrame }; -static void oledTitle(OLEDDisplay *display, String s) { +static void oledTitle(OLEDDisplay *display, String s, int16_t x, int16_t y) { // Title display->setFont(Roboto_Mono_13); display->setTextAlignment(TEXT_ALIGN_CENTER); - display->drawString(64, 0, s); + display->drawString(64+x, 0+y, s); display->setFont(Roboto_Mono_10); - display->setTextAlignment(TEXT_ALIGN_LEFT); } void oledWebFrame(OLEDDisplay *display, OLEDDisplayUiState* state, int16_t x, int16_t y) { // Title - oledTitle(display, "Fox Home"); + oledTitle(display, "Fox Home", x, y); - // Day View - display->drawString(0, 16, "Today"); - display->setTextAlignment(TEXT_ALIGN_RIGHT); - display->drawString(120, 16, (String)dayView); + // Items display->setTextAlignment(TEXT_ALIGN_LEFT); - - // Week View - display->drawString(0, 30, "Last Week"); + display->drawString(0+x, 16+y, "Today"); + display->drawString(0+x, 30+y, "Last Week"); + display->drawString(0+x, 44+y, "Last Month"); + + // Values display->setTextAlignment(TEXT_ALIGN_RIGHT); - display->drawString(120, 30, (String)weekView); - display->setTextAlignment(TEXT_ALIGN_LEFT); - - // Month View - display->drawString(0, 44, "Last Month"); - display->setTextAlignment(TEXT_ALIGN_RIGHT); - display->drawString(120, 44, (String)monthView); - display->setTextAlignment(TEXT_ALIGN_LEFT); + display->drawString(120+x, 16+y, (String)dayView); + display->drawString(120+x, 30+y, (String)weekView); + display->drawString(120+x, 44+y, (String)monthView); } void oledMQTTFrame(OLEDDisplay *display, OLEDDisplayUiState* state, int16_t x, int16_t y) { @@ -68,39 +60,34 @@ void oledMQTTFrame(OLEDDisplay *display, OLEDDisplayUiState* state, int16_t x, i void oledBilibiliFrame(OLEDDisplay *display, OLEDDisplayUiState* state, int16_t x, int16_t y) { // Title - oledTitle(display, "BiliBili"); + oledTitle(display, "BiliBili", x, y); - // Follower - display->drawString(0, 16, "Follower"); - display->setTextAlignment(TEXT_ALIGN_RIGHT); - display->drawString(120, 16, (String)follower); + // Items display->setTextAlignment(TEXT_ALIGN_LEFT); - - // View - display->drawString(0, 30, "View"); + display->drawString(0+x, 16+y, "Follower"); + display->drawString(0+x, 30+y, "View"); + display->drawString(0+x, 44+y, "Likes"); + + // Values display->setTextAlignment(TEXT_ALIGN_RIGHT); - display->drawString(120, 30, (String)view); - display->setTextAlignment(TEXT_ALIGN_LEFT); - - // Likes - display->drawString(0, 44, "Likes"); - display->setTextAlignment(TEXT_ALIGN_RIGHT); - display->drawString(120, 44, (String)likes); - display->setTextAlignment(TEXT_ALIGN_LEFT); + display->drawString(120+x, 16+y, (String)follower); + display->drawString(120+x, 30+y, (String)view); + display->drawString(120+x, 44+y, (String)likes); } void oledOsFrame(OLEDDisplay *display, OLEDDisplayUiState* state, int16_t x, int16_t y) { // Title - oledTitle(display, "INFO BOARD"); + oledTitle(display, "INFO BOARD", x, y); + display->setTextAlignment(TEXT_ALIGN_LEFT); // Version - display->drawFastImage(0, 16, 16, 16, Board_Icon); - display->drawString(24, 18, ver); + display->drawFastImage(0+x, 16+y, 16, 16, Board_Icon); + display->drawString(24+x, 18+y, ver); // WiFi if( localIP == "Unconnected") - display->drawFastImage(0, 34, 16, 16, Wifi_Unconnected_Icon); + display->drawFastImage(0+x, 34+y, 16, 16, Wifi_Unconnected_Icon); else - display->drawFastImage(0, 34, 16, 16, Wifi_Connected_Icon); - display->drawString(24, 36, localIP); + display->drawFastImage(0+x, 34+y, 16, 16, Wifi_Connected_Icon); + display->drawString(24+x, 36+y, localIP); } \ No newline at end of file