From f98d33ace29b0be0edaab45e4c8530f8387d779c Mon Sep 17 00:00:00 2001 From: Sahin Habermann Date: Sat, 24 Feb 2018 16:04:24 +0100 Subject: [PATCH] Added back button --- Makefile.pc | 12 +++++++++++- common/menu.c | 24 ++++++++++++++++++++++++ common/theme.c | 8 ++++++-- common/theme.h | 3 ++- data/button_b_dark.bin | Bin 0 -> 4096 bytes data/button_b_light.bin | Bin 0 -> 4096 bytes 6 files changed, 43 insertions(+), 4 deletions(-) create mode 100644 data/button_b_dark.bin create mode 100644 data/button_b_light.bin diff --git a/Makefile.pc b/Makefile.pc index ed2758f..af742b9 100644 --- a/Makefile.pc +++ b/Makefile.pc @@ -14,7 +14,7 @@ test : pc_main/main.cpp pc_main/pc_launch.c \ build_pc/tahoma24.o build_pc/tahoma12.o build_pc/interuimedium20.o build_pc/interuimedium30.o \ build_pc/interuiregular14.o build_pc/interuiregular18.o \ build_pc/switchicon_questionmark.bin.o build_pc/folder_icon.bin.o \ - build_pc/button_a_light.bin.o build_pc/button_a_dark.bin.o build_pc/hbmenu_logo_light.bin.o build_pc/hbmenu_logo_dark.bin.o + build_pc/button_a_light.bin.o build_pc/button_a_dark.bin.o build_pc/button_b_light.bin.o build_pc/button_b_dark.bin.o build_pc/hbmenu_logo_light.bin.o build_pc/hbmenu_logo_dark.bin.o gcc -Wall -O2 -g0 $^ -lsfml-graphics -lsfml-window -lsfml-system -lstdc++ -lm -I. -Ibuild_pc -o $@ build_pc/tahoma12.o : data/tahoma12.nxfnt @@ -66,6 +66,16 @@ build_pc/button_a_dark.bin.o : data/button_a_dark.bin mkdir -p $(dir $@) @echo $(notdir $<) @$(bin2o) + +build_pc/button_b_light.bin.o : data/button_b_light.bin + mkdir -p $(dir $@) + @echo $(notdir $<) + @$(bin2o) + +build_pc/button_b_dark.bin.o : data/button_b_dark.bin + mkdir -p $(dir $@) + @echo $(notdir $<) + @$(bin2o) build_pc/hbmenu_logo_light.bin.o : data/hbmenu_logo_light.bin mkdir -p $(dir $@) diff --git a/common/menu.c b/common/menu.c index 1f58251..5bef834 100644 --- a/common/menu.c +++ b/common/menu.c @@ -276,6 +276,26 @@ void drawTime() { } +void drawBackBtn(menu_s* menu, bool emptyDir) { + int x_image = 1280 - 252 - 30; + int x_text = 1280 - 216 - 30; + + if(emptyDir) { + x_image = 1280 - 126 - 30; + x_text = 1280 - 90 - 30; + } + + #ifdef SWITCH + if (strcmp( menu->dirname, "sdmc:/") != 0) + #else + if (strcmp( menu->dirname, "/") != 0) + #endif + { + drawImage(x_image, 720 - 48, 32, 32, themeCurrent.buttonBImage, IMAGE_MODE_RGBA32); + DrawText(interuiregular18, x_text, 720 - 47, themeCurrent.textColor, "Back"); + } +} + void menuLoop() { menuEntry_s* me; menu_s* menu = menuGetCurrent(); @@ -299,9 +319,11 @@ void menuLoop() { //drawTime(); + if (menu->nEntries==0) { DrawText(interuiregular14, 64, 128, themeCurrent.textColor, textGetString(StrId_NoAppsFound_Msg)); + drawBackBtn(menu, true); } else { @@ -325,5 +347,7 @@ void menuLoop() { drawEntry(me, entry_start_x + x, i==menu->curEntry); } + + drawBackBtn(menu, false); } } diff --git a/common/theme.c b/common/theme.c index 7a03681..8af9de0 100644 --- a/common/theme.c +++ b/common/theme.c @@ -1,6 +1,8 @@ #include "theme.h" #include "button_a_light_bin.h" -#include "button_a_dark_bin.h" +#include "button_a_dark_bin.h" +#include "button_b_light_bin.h" +#include "button_b_dark_bin.h" #include "hbmenu_logo_light_bin.h" #include "hbmenu_logo_dark_bin.h" @@ -15,7 +17,8 @@ void themeStartup(ThemePreset preset) { backgroundColor: MakeColor(233, 236, 241, 255), highlightColor: MakeColor(91, 237, 224, 255), enableWaveBlending: 0, - buttonAImage: button_a_light_bin, + buttonAImage: button_a_light_bin, + buttonBImage: button_b_light_bin, hbmenuLogoImage: hbmenu_logo_light_bin }; break; @@ -30,6 +33,7 @@ void themeStartup(ThemePreset preset) { highlightColor: MakeColor(91, 237, 224, 255), enableWaveBlending: 0, buttonAImage: button_a_dark_bin, + buttonBImage: button_b_dark_bin, hbmenuLogoImage: hbmenu_logo_dark_bin }; break; diff --git a/common/theme.h b/common/theme.h index 331d0c5..d6d776f 100644 --- a/common/theme.h +++ b/common/theme.h @@ -11,7 +11,8 @@ typedef struct color_t backgroundColor; color_t highlightColor; bool enableWaveBlending; - const uint8_t *buttonAImage; + const uint8_t *buttonAImage; + const uint8_t *buttonBImage; const uint8_t *hbmenuLogoImage; } theme_t; diff --git a/data/button_b_dark.bin b/data/button_b_dark.bin new file mode 100644 index 0000000000000000000000000000000000000000..e05f1108319197bd91898727b02f75114ac8ec1b GIT binary patch literal 4096 zcmeH}y-Gtt5QW9Y+80RFClC=q?8QQaRQ})_h=}-?%FfEpP6RuD5D`Q~)A$-bfIfjX zDw_Bm$%Y~9tef1F8940T**Rxs=k8r@qtO^>^wIA@-We!yR;r)|Ucd)<2hZRUXl)eq zx}VB>4!*&E_CtVT#py*I3+TLoPECDT21RPvfUo^@Yjud5pqm;N;fY_=q#>6*b89$rgq{)_Lk=gnFA`i^SD85Po!=RaRpu2iYkbo2 zOqyk2bH(O+o&f%P!+$Vwr%nGb$(sm+BOfN4_^M9^OySmZ2#@~za{sa$*($Nmh=6M zK=ke(85xytY5~6_;T-G>6gHJL`V6@ zfzH?zm8H@tuAwi`ilI2trW~1YS6pW r`SHFBmRhD5#di9>L$1^)%_`72(_Qw}gy!;TZ49I|`fL6Ew9ddU0RUP) literal 0 HcmV?d00001 diff --git a/data/button_b_light.bin b/data/button_b_light.bin new file mode 100644 index 0000000000000000000000000000000000000000..743d3414b349dbffe10cf96784cfd1b14a161464 GIT binary patch literal 4096 zcmeH~%}x|S5XXrZ&%A)Be19*?vSisaB8ib05_FB>Ob{dB2b_e97fd)TCu1;>u&yzL z#1P_g@eMd|@&S|=&5b=Uu2T~%GPYmBKg7xG`kpu4-f z?mQ$a-wC*{$eBfveUYys$09#OzKB#r*t;h3&wHGKAKrH&zeP-poH%E(3H75&{@a4{ zJ%%&PC*o2F^Pvj<$6|ld*4AbQ1_n%fd%NlC>M|W29VVSlo1UH?yGF+zYxOggN-;kb znG^BFAtC==$KDJM4w}x+PAl;C_4QdFdV6~> z9J}%+x25(!EH5wDD?hQo-w1xN*6bdityWD$gYb&FAdJ?{Q`oG2!Ot9nXpB_Z7R6E;C=x5+6PuRG=zMjwJ za_{jqzwrCMKaGuzwgYUh5r2ii~j-iijBws literal 0 HcmV?d00001