diff options
-rw-r--r-- | api.cpp | 16 | ||||
-rw-r--r-- | api.hpp | 8 |
2 files changed, 15 insertions, 9 deletions
@@ -92,7 +92,7 @@ bool Api::gui_popup_text(std::string title, std::string body){ m_send_button_press_to_app = true; } -bool Api::gui_footer_text(std::string text, int offset_x, int offset_row, int invert) { +bool Api::gui_footer_text(std::string text, int offset_x, int offset_row, bool invert, bool no_bg) { // Max chars per line for FONT_8x8 is 16 chars // Max chars per line for FONT_6x8 is 21 chars // Truncate longer text @@ -106,12 +106,14 @@ bool Api::gui_footer_text(std::string text, int offset_x, int offset_row, int in else font = FONT_8x8; - oledRectangle(&m_oled, 0,56, 128,64, invert, 1); - oledDumpBuffer(&m_oled, m_ucBuffer); + if (!no_bg) { + oledRectangle(&m_oled, 0,56-offset_row*8, 127,64-offset_row*8, invert, 1); + oledDumpBuffer(&m_oled, m_ucBuffer); + } oledWriteString(&m_oled, 0,offset_x,7-offset_row, &text[0], font, invert, 1); } -bool Api::gui_header_text(std::string text, int offset_x, int offset_row, int invert) { +bool Api::gui_header_text(std::string text, int offset_x, int offset_row, bool invert, bool no_bg) { // Max chars per line for FONT_8x8 is 16 chars // Max chars per line for FONT_6x8 is 21 chars // Truncate longer text @@ -125,8 +127,10 @@ bool Api::gui_header_text(std::string text, int offset_x, int offset_row, int in else font = FONT_8x8; - oledRectangle(&m_oled, 0,0, 128,8, invert, 1); - oledDumpBuffer(&m_oled, m_ucBuffer); + if (!no_bg) { + oledRectangle(&m_oled, 0,0+offset_row*8, 127,8+offset_row*8, invert, 1); + oledDumpBuffer(&m_oled, m_ucBuffer); + } oledWriteString(&m_oled, 0,offset_x,0+offset_row, &text[0], font, invert, 1); } @@ -45,15 +45,17 @@ class Api { // \param text Text to display. Text longer than 21 will be truncated. // \param offset_x Set a horizental offset, to allow, for example, centering the text // \param offset_row Allow rendering the text higher. For example, one line higher when `offset_row = 1`. - // \param invert allow inverting text and background color. - bool gui_footer_text(std::string text, int offset_x = 0, int offset_row = 0, int invert = 0); + // \param invert Invert text and background color. + // \param no_bg Do not draw background when true. + bool gui_footer_text(std::string text, int offset_x = 0, int offset_row = 0, bool invert = false, bool no_bg = false); // Display text at the top of the screen. // The font size is automatically choosen based on the text lenght. // \param text Text to display. Text longer than 21 will be truncated. // \param offset_x Set a horizental offset, to allow, for example, centering the text // \param offset_row Render text lines lower. For example, one text line lower with `offset_row = 1`. // \param invert Invert text and background color. - bool gui_header_text(std::string text, int offset_x = 0, int offset_row = 0, int invert = 0); + // \param no_bg Do not draw background when true. + bool gui_header_text(std::string text, int offset_x = 0, int offset_row = 0, bool invert = false, bool no_bg = false); // Set performance mode. // FIXME: function currently does nothing! // An app should choose the lowest performance that can make it function. Set in init(). Only when required, higher performance should be used. |