diff --git a/src/clock/main.c b/src/clock/main.c index c942f19..aad459c 100644 --- a/src/clock/main.c +++ b/src/clock/main.c @@ -239,7 +239,12 @@ int main(int argc , char* argv[]) { GFX_blitHardwareGroup(screen, show_setting); - GFX_blitButtonGroup((char*[]){ "SELECT",show_24hour?"12 HOUR":"24 HOUR", NULL }, screen, 0); + if (show_setting) { + if (PAD_isPressed(BTN_MENU)) GFX_blitButtonGroup((char*[]){ BRIGHTNESS_BUTTON_LABEL,"BRIGHTNESS", NULL }, screen, 0); + else GFX_blitButtonGroup((char*[]){ "MENU","BRIGHTNESS", NULL }, screen, 0); + } + else GFX_blitButtonGroup((char*[]){ "SELECT",show_24hour?"12 HOUR":"24 HOUR", NULL }, screen, 0); + GFX_blitButtonGroup((char*[]){ "B","CANCEL", "A","SET", NULL }, screen, 1); // datetime diff --git a/src/common/api.c b/src/common/api.c index 4579994..19dc6a3 100644 --- a/src/common/api.c +++ b/src/common/api.c @@ -474,12 +474,14 @@ int GFX_getButtonWidth(char* hint, char* button) { int button_width = 0; int width; + int special_case = !strcmp(button,BRIGHTNESS_BUTTON_LABEL); // TODO: oof + if (strlen(button)==1) { button_width += SCALE1(BUTTON_SIZE); } else { button_width += SCALE1(BUTTON_SIZE) / 2; - TTF_SizeUTF8(font.tiny, button, &width, NULL); + TTF_SizeUTF8(special_case ? font.large : font.tiny, button, &width, NULL); button_width += width; } button_width += SCALE1(BUTTON_MARGIN); @@ -492,6 +494,8 @@ void GFX_blitButton(char* hint, char*button, SDL_Surface* dst, SDL_Rect* dst_rec SDL_Surface* text; int ox = 0; + int special_case = !strcmp(button,BRIGHTNESS_BUTTON_LABEL); // TODO: oof + // button if (strlen(button)==1) { GFX_blitAsset(ASSET_BUTTON, NULL, dst, dst_rect); @@ -503,11 +507,12 @@ void GFX_blitButton(char* hint, char*button, SDL_Surface* dst, SDL_Rect* dst_rec SDL_FreeSurface(text); } else { - text = TTF_RenderUTF8_Blended(font.tiny, button, COLOR_BUTTON_TEXT); + text = TTF_RenderUTF8_Blended(special_case ? font.large : font.tiny, button, COLOR_BUTTON_TEXT); GFX_blitPill(ASSET_BUTTON, dst, &(SDL_Rect){dst_rect->x,dst_rect->y,SCALE1(BUTTON_SIZE)/2+text->w,SCALE1(BUTTON_SIZE)}); ox += SCALE1(BUTTON_SIZE)/4; - SDL_BlitSurface(text, NULL, dst, &(SDL_Rect){ox+dst_rect->x,dst_rect->y+(SCALE1(BUTTON_SIZE)-text->h)/2,text->w,text->h}); + int oy = special_case ? SCALE1(-2) : 0; + SDL_BlitSurface(text, NULL, dst, &(SDL_Rect){ox+dst_rect->x,oy+dst_rect->y+(SCALE1(BUTTON_SIZE)-text->h)/2,text->w,text->h}); ox += text->w; ox += SCALE1(BUTTON_SIZE)/4; SDL_FreeSurface(text); @@ -1052,7 +1057,7 @@ void POW_update(int* _dirty, int* _show_setting, POW_callback_t before_sleep, PO int was_dirty = dirty; // dirty list (not including settings/battery) - #define SETTING_DELAY 500 + #define SETTING_DELAY 750 if (show_setting && now-setting_start>=SETTING_DELAY && !PAD_isPressed(BTN_MENU)) { show_setting = 0; dirty = 1; diff --git a/src/common/api.h b/src/common/api.h index 2d129b0..cb90df2 100644 --- a/src/common/api.h +++ b/src/common/api.h @@ -179,6 +179,7 @@ int PAD_justRepeated(int btn); /////////////////////////////// // TODO: rename PLAT_*? +#define BRIGHTNESS_BUTTON_LABEL "+ -" typedef void (*POW_callback_t)(void); void POW_update(int* dirty, int* show_setting, POW_callback_t before_sleep, POW_callback_t after_sleep); void POW_disablePowerOff(void); diff --git a/src/minarch/main.c b/src/minarch/main.c index c6ef993..de2bec9 100644 --- a/src/minarch/main.c +++ b/src/minarch/main.c @@ -3355,7 +3355,11 @@ static void Menu_loop(void) { }); SDL_FreeSurface(text); - GFX_blitButtonGroup((char*[]){ "POWER","SLEEP", NULL }, screen, 0); + if (show_setting) { + if (PAD_isPressed(BTN_MENU)) GFX_blitButtonGroup((char*[]){ BRIGHTNESS_BUTTON_LABEL,"BRIGHTNESS", NULL }, screen, 0); + else GFX_blitButtonGroup((char*[]){ "MENU","BRIGHTNESS", NULL }, screen, 0); + } + else GFX_blitButtonGroup((char*[]){ "POWER","SLEEP", NULL }, screen, 0); GFX_blitButtonGroup((char*[]){ "B","BACK", "A","OKAY", NULL }, screen, 1); // list diff --git a/src/minui/main.c b/src/minui/main.c index 90ee850..8e19a40 100644 --- a/src/minui/main.c +++ b/src/minui/main.c @@ -1424,7 +1424,8 @@ int main (int argc, char *argv[]) { // buttons if (show_setting) { - GFX_blitButtonGroup((char*[]){ "MENU","BRIGHTNESS", NULL }, screen, 0); + if (PAD_isPressed(BTN_MENU)) GFX_blitButtonGroup((char*[]){ BRIGHTNESS_BUTTON_LABEL,"BRIGHTNESS", NULL }, screen, 0); + else GFX_blitButtonGroup((char*[]){ "MENU","BRIGHTNESS", NULL }, screen, 0); } else if (can_resume) { GFX_blitButtonGroup((char*[]){ "X","RESUME", NULL }, screen, 0);