tweaks around the brightness hint
show MENU Brightness when pressing +/-, show + - when holding MENU
This commit is contained in:
parent
4bb5bf11ba
commit
2793ae4973
5 changed files with 23 additions and 7 deletions
|
|
@ -239,7 +239,12 @@ int main(int argc , char* argv[]) {
|
||||||
|
|
||||||
GFX_blitHardwareGroup(screen, show_setting);
|
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);
|
GFX_blitButtonGroup((char*[]){ "B","CANCEL", "A","SET", NULL }, screen, 1);
|
||||||
|
|
||||||
// datetime
|
// datetime
|
||||||
|
|
|
||||||
|
|
@ -474,12 +474,14 @@ int GFX_getButtonWidth(char* hint, char* button) {
|
||||||
int button_width = 0;
|
int button_width = 0;
|
||||||
int width;
|
int width;
|
||||||
|
|
||||||
|
int special_case = !strcmp(button,BRIGHTNESS_BUTTON_LABEL); // TODO: oof
|
||||||
|
|
||||||
if (strlen(button)==1) {
|
if (strlen(button)==1) {
|
||||||
button_width += SCALE1(BUTTON_SIZE);
|
button_width += SCALE1(BUTTON_SIZE);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
button_width += SCALE1(BUTTON_SIZE) / 2;
|
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 += width;
|
||||||
}
|
}
|
||||||
button_width += SCALE1(BUTTON_MARGIN);
|
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;
|
SDL_Surface* text;
|
||||||
int ox = 0;
|
int ox = 0;
|
||||||
|
|
||||||
|
int special_case = !strcmp(button,BRIGHTNESS_BUTTON_LABEL); // TODO: oof
|
||||||
|
|
||||||
// button
|
// button
|
||||||
if (strlen(button)==1) {
|
if (strlen(button)==1) {
|
||||||
GFX_blitAsset(ASSET_BUTTON, NULL, dst, dst_rect);
|
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);
|
SDL_FreeSurface(text);
|
||||||
}
|
}
|
||||||
else {
|
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)});
|
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;
|
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 += text->w;
|
||||||
ox += SCALE1(BUTTON_SIZE)/4;
|
ox += SCALE1(BUTTON_SIZE)/4;
|
||||||
SDL_FreeSurface(text);
|
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)
|
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)) {
|
if (show_setting && now-setting_start>=SETTING_DELAY && !PAD_isPressed(BTN_MENU)) {
|
||||||
show_setting = 0;
|
show_setting = 0;
|
||||||
dirty = 1;
|
dirty = 1;
|
||||||
|
|
|
||||||
|
|
@ -179,6 +179,7 @@ int PAD_justRepeated(int btn);
|
||||||
///////////////////////////////
|
///////////////////////////////
|
||||||
|
|
||||||
// TODO: rename PLAT_*?
|
// TODO: rename PLAT_*?
|
||||||
|
#define BRIGHTNESS_BUTTON_LABEL "+ -"
|
||||||
typedef void (*POW_callback_t)(void);
|
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_update(int* dirty, int* show_setting, POW_callback_t before_sleep, POW_callback_t after_sleep);
|
||||||
void POW_disablePowerOff(void);
|
void POW_disablePowerOff(void);
|
||||||
|
|
|
||||||
|
|
@ -3355,7 +3355,11 @@ static void Menu_loop(void) {
|
||||||
});
|
});
|
||||||
SDL_FreeSurface(text);
|
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);
|
GFX_blitButtonGroup((char*[]){ "B","BACK", "A","OKAY", NULL }, screen, 1);
|
||||||
|
|
||||||
// list
|
// list
|
||||||
|
|
|
||||||
|
|
@ -1424,7 +1424,8 @@ int main (int argc, char *argv[]) {
|
||||||
|
|
||||||
// buttons
|
// buttons
|
||||||
if (show_setting) {
|
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) {
|
else if (can_resume) {
|
||||||
GFX_blitButtonGroup((char*[]){ "X","RESUME", NULL }, screen, 0);
|
GFX_blitButtonGroup((char*[]){ "X","RESUME", NULL }, screen, 0);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue