mirror of
https://gitee.com/anod/open_agb_firm.git
synced 2025-05-07 06:14:12 +08:00
把filebrowser.c中的前景色修改为枚举值而不是rgb565
This commit is contained in:
parent
d81b19b11c
commit
acf15d935f
@ -60,8 +60,8 @@ const char *acf_put_text(int x, int y, int width, int height, int maxwidth, u8 c
|
||||
static void screen_clean()
|
||||
{
|
||||
memset(consoleGet()->frameBuffer, 0, WINDOW_WIDTH*WINDOW_HEIGHT*sizeof(uint16_t));
|
||||
acf_put_text( 5, 215, WINDOW_WIDTH, WINDOW_HEIGHT, WINDOW_WIDTH-10, ATP_COLOR_BLUE, ATP_PLACEMENT_LEFT, ta );
|
||||
acf_put_text( 5, 215, WINDOW_WIDTH, WINDOW_HEIGHT, WINDOW_WIDTH-10, ATP_COLOR_BLUE, ATP_PLACEMENT_RIGHT, tb );
|
||||
if( ta[0] ) acf_put_text( 5, 215, WINDOW_WIDTH, WINDOW_HEIGHT, WINDOW_WIDTH-10, ATP_COLOR_BLUE, ATP_PLACEMENT_LEFT, ta );
|
||||
if( tb[0] ) acf_put_text( 5, 215, WINDOW_WIDTH, WINDOW_HEIGHT, WINDOW_WIDTH-10, ATP_COLOR_BLUE, ATP_PLACEMENT_RIGHT, tb );
|
||||
}
|
||||
|
||||
// wait key pressed, if power key is pressed, return 0
|
||||
|
@ -59,10 +59,11 @@ typedef struct
|
||||
char *ptrs[MAX_DIR_ENTRIES]; // For fast sorting.
|
||||
} DirList;
|
||||
|
||||
const char *acf_put_text(int x, int y, int width, int height, int maxwidth, u8 color, u8 placement, const char* text);
|
||||
extern const char *acf_put_text(int x, int y, int width, int height, int maxwidth, u8 color, u8 placement, const char* text);
|
||||
|
||||
const char *acf_draw(int x, int y, int width, int height, int maxwidth, u8 color, const char* text)
|
||||
{
|
||||
return atp_put_text(x, y, width, height, maxwidth, color, ATP_PLACEMENT_LEFT, text);
|
||||
return acf_put_text(x, y, width, height, maxwidth, color, ATP_PLACEMENT_LEFT, text);
|
||||
}
|
||||
|
||||
static const char *page[] = {
|
||||
@ -90,7 +91,7 @@ static const char *page[] = {
|
||||
"女儿情长埋葬"
|
||||
};
|
||||
|
||||
static atp_error_t test_show( atp_callerdata_t data, atp_counter_t idx, atp_text_t *ptext, atp_itemval_t *pval, atp_color_t *c, atp_placement_t *p )
|
||||
static atp_error_t test_show( atp_callerdata_t , atp_counter_t idx, atp_text_t *ptext, atp_itemval_t *, atp_color_t *, atp_placement_t * )
|
||||
{
|
||||
if( idx < sizeof(page) ){
|
||||
*ptext = page[idx];
|
||||
@ -184,7 +185,7 @@ static void showDirList(const DirList *const dList, u32 start)
|
||||
|
||||
//ee_printf(printStr, i - start, &dList->ptrs[i][1]); // TODO: use acf to display
|
||||
const uint8_t fg = *dList -> ptrs[i] == ENT_TYPE_FILE ? 7 : 6;
|
||||
acf_draw(CLEFTMARGIN, LINENO_TO_Y(i-start), CWIDTH, CHEIGHT, CLINELIMIT, consoleGetRGB565Color(fg), &dList->ptrs[i][1] );
|
||||
acf_draw(CLEFTMARGIN, LINENO_TO_Y(i-start), CWIDTH, CHEIGHT, CLINELIMIT, fg, &dList->ptrs[i][1] );
|
||||
}
|
||||
}
|
||||
|
||||
@ -215,13 +216,13 @@ Result browseFiles(const char *const basePath, char selected[512])
|
||||
if( oldCursorPos != cursorPos && windowPos <= (u32)oldCursorPos && (u32)oldCursorPos < windowPos + SCREEN_ROWS )
|
||||
{
|
||||
const uint8_t fg = *dList -> ptrs[oldCursorPos] == ENT_TYPE_FILE ? 7:6;
|
||||
acf_draw( CLEFTMARGIN, LINENO_TO_Y(oldCursorPos-windowPos), CWIDTH, CHEIGHT, CLINELIMIT, consoleGetRGB565Color(fg), &dList->ptrs[oldCursorPos][1] );
|
||||
acf_draw( CLEFTMARGIN, LINENO_TO_Y(oldCursorPos-windowPos), CWIDTH, CHEIGHT, CLINELIMIT, fg, &dList->ptrs[oldCursorPos][1] );
|
||||
}
|
||||
acf_draw( CLEFTMARGIN, LINENO_TO_Y(cursorPos-windowPos), CWIDTH, CHEIGHT, CLINELIMIT, consoleGetRGB565Color(3), &dList->ptrs[cursorPos][1] );
|
||||
acf_draw( CLEFTMARGIN, LINENO_TO_Y(cursorPos-windowPos), CWIDTH, CHEIGHT, CLINELIMIT, 3, &dList->ptrs[cursorPos][1] );
|
||||
}
|
||||
else {
|
||||
//ee_printf("\x1b[%lu;H\x1b[0m>%.51s", cursorPos - windowPos, "<no gba rom>");
|
||||
acf_draw( CLEFTMARGIN, LINENO_TO_Y(cursorPos-windowPos), CWIDTH, CHEIGHT, CLINELIMIT, consoleGetRGB565Color(7), "<NO GBA ROM>" );
|
||||
acf_draw( CLEFTMARGIN, LINENO_TO_Y(cursorPos-windowPos), CWIDTH, CHEIGHT, CLINELIMIT, 7, "<NO GBA ROM>" );
|
||||
}
|
||||
|
||||
u32 kDown;
|
||||
@ -296,7 +297,12 @@ Result browseFiles(const char *const basePath, char selected[512])
|
||||
}
|
||||
|
||||
if( kDown & KEY_X ){
|
||||
if( atp_show( 22, test_show, NULL ) == 0 ) goto end;
|
||||
atp_tips(curDir, NULL);
|
||||
if( atp_show( 22, test_show, NULL ) == ATP_POWER_OFF )
|
||||
{
|
||||
res = RES_NOT_FOUND;
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user