mirror of
https://github.com/suchmememanyskill/TegraExplorer.git
synced 2024-11-09 21:51:48 +00:00
be79d64deb
+ fix compile error + move back to top of menus
62 lines
No EOL
1.8 KiB
C
62 lines
No EOL
1.8 KiB
C
#include "../gfx/gfx.h"
|
|
#include "te.h"
|
|
#include "../utils/btn.h"
|
|
#include "gfx.h"
|
|
|
|
void clearscreen(){
|
|
gfx_clear_grey(0x1B);
|
|
gfx_box(0, 0, 719, 15, COLOR_WHITE);
|
|
gfx_con_setpos(0, 0);
|
|
gfx_printf("%k%KTegraexplorer%k%K\n", COLOR_DEFAULT, COLOR_WHITE, COLOR_WHITE, COLOR_DEFAULT);
|
|
}
|
|
|
|
int message(char* message, u32 color){
|
|
clearscreen();
|
|
gfx_printf("%k%s%k", color, message, COLOR_DEFAULT);
|
|
return btn_wait();
|
|
}
|
|
|
|
int makemenu(menu_item menu[], int menuamount){
|
|
int currentpos = 1, i, res;
|
|
clearscreen();
|
|
|
|
while (1){
|
|
gfx_con_setpos(0, 31);
|
|
|
|
if (currentpos == 1){
|
|
while (currentpos < menuamount && menu[currentpos - 1].property < 1)
|
|
currentpos++;
|
|
}
|
|
if (currentpos == menuamount){
|
|
while (currentpos > 1 && menu[currentpos - 1].property < 1)
|
|
currentpos--;
|
|
}
|
|
|
|
for (i = 0; i < menuamount; i++){
|
|
if (menu[i].property < 0)
|
|
continue;
|
|
if (i == currentpos - 1)
|
|
gfx_printf("%k%K%s%K\n", COLOR_DEFAULT, COLOR_WHITE, menu[i].name, COLOR_DEFAULT);
|
|
else
|
|
gfx_printf("%k%s\n", menu[i].color, menu[i].name);
|
|
}
|
|
gfx_printf("\n%k%s", COLOR_WHITE, menuamount);
|
|
|
|
res = btn_wait();
|
|
|
|
if (res & BTN_VOL_UP && currentpos > 1){
|
|
currentpos--;
|
|
while(menu[currentpos - 1].property < 1 && currentpos > 1)
|
|
currentpos--;
|
|
}
|
|
|
|
else if (res & BTN_VOL_DOWN && currentpos < menuamount){
|
|
currentpos++;
|
|
while(menu[currentpos - 1].property < 1 && currentpos < menuamount)
|
|
currentpos++;
|
|
}
|
|
|
|
else if (res & BTN_POWER)
|
|
return menu[currentpos - 1].internal_function;
|
|
}
|
|
} |