Fixed: formatting + pen saving
@@ -59,6 +59,7 @@ void FirmwareMenu::prepare() {
selected_item_background = get_menu_colour(4);
header_background = get_menu_colour(9);
header_foreground = get_menu_colour(10);
+ bar_highlight_color = get_menu_colour(11);
display_rect.w = screen.bounds.w;
display_rect.h = screen.bounds.h;
@@ -89,13 +90,13 @@ void FirmwareMenu::render_item(const Item &item, int y, int index) const {
draw_slider(Point(bar_x, y + bar_margin), bar_width, persist.backlight, foreground_colour);
break;
case VOLUME:
- if ( persist.is_muted ) {
- auto prev_pen = screen.pen;
- screen.pen = get_menu_colour(11);
+ if (persist.is_muted)
+ {
+ screen.pen = bar_highlight_color;
screen.text("Muted", minimal_font, Point(screen_width - item_padding_x, y + 1), true, TextAlign::right);
- screen.pen = prev_pen;
}
- else {
+ else
+ {
draw_slider(Point(bar_x, y + bar_margin), bar_width, persist.volume, foreground_colour);
}
break;
@@ -135,7 +136,8 @@ void FirmwareMenu::render_footer(int x, int y, int w) {
void FirmwareMenu::update_slider_item_value(float &value) {
if (blit::buttons.released & blit::Button::DPAD_LEFT) {
value -= 1.0f / 12.0f;
- } else if (blit::buttons.released & blit::Button::DPAD_RIGHT) {
+ }
+ else if (blit::buttons.released & blit::Button::DPAD_RIGHT) {
value += 1.0f / 12.0f;
}
}
@@ -147,12 +149,15 @@ void FirmwareMenu::update_item(const Item &item) {
if (item.id == BACKLIGHT) {
update_slider_item_value(persist.backlight);
persist.backlight = std::fmin(1.0f, std::fmax(0.0f, persist.backlight));
- } else if(item.id == VOLUME) {
+ }
+ else if (item.id == VOLUME) {
update_slider_item_value(persist.volume);
persist.volume = std::fmin(1.0f, std::fmax(0.0f, persist.volume));
blit_update_volume();
- } else if(item.id == BATTERY_INFO) {
- if (blit::buttons.released & blit::Button::DPAD_RIGHT) {
+ }
+ else if (item.id == BATTERY_INFO) {
+ if (blit::buttons.released & blit::Button::DPAD_RIGHT)
+ {
system_menu.set_menu(SystemMenus::Battery);
}
}
