测试通过了无console API的显示颜色的代码

This commit is contained in:
root 2022-08-10 14:08:37 +08:00
parent d049280d4a
commit da5e8092da
2 changed files with 6 additions and 6 deletions

View File

@ -13,7 +13,7 @@
#define ACFONT_MEM_EMPTY 5
extern int acf_set_font(const char *);
extern const char *acf_draw(int, int, unsigned, unsigned, unsigned, const char *);
extern const char *acf_draw(int, int, unsigned, unsigned, unsigned, uint16_t, const char *);
#define ACF_LIT_POINT(x, y, w, h, islit) \
{ \

View File

@ -28,7 +28,7 @@
#include "drivers/gfx.h"
#include "arm11/acf.h"
#define screenClean() for( uint16_t *vram=consoleGet()->frameBuffer, c=CWIDTH*CHEIGHT; c-->0; vram++ ) *vram=0
#define screenClean() memset(consoleGet()->frameBuffer, 0, CWIDTH*CHEIGHT*sizeof(uint16_t))
// Notes on these settings:
// MAX_ENT_BUF_SIZE should be big enough to hold the average file/dir name length * MAX_DIR_ENTRIES.
@ -142,7 +142,7 @@ static void showDirList(const DirList *const dList, u32 start)
// (*dList->ptrs[i] == ENT_TYPE_FILE ? "\x1b[%lu;H\x1b[37m %.51s" : "\x1b[%lu;H\x1b[36m %.51s");
//ee_printf(printStr, i - start, &dList->ptrs[i][1]); // TODO: use acf to display
const uint8_t fg = *dList -> ptrs[i] == ENT_TYPE_FILE ? 37 : 36;
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] );
}
}
@ -171,12 +171,12 @@ Result browseFiles(const char *const basePath, char selected[512])
if( dList->num > 0 ){
//ee_printf(*dList->ptrs[oldCursorPos] == ENT_TYPE_FILE ? "\x1b[%lu;H\x1b[37m %.51s" : "\x1b[%lu;H\x1b[36m %.51s", oldCursorPos - windowPos, &dList->ptrs[oldCursorPos][1]); // Clear old cursor.
//ee_printf("\x1b[%lu;H\x1b[33m>%.51s", cursorPos - windowPos, &dList->ptrs[cursorPos][1]); // Draw cursor.
if( oldCursorPos != cursorPos )
if( oldCursorPos != cursorPos && windowPos <= oldCursorPos && oldCursorPos < windowPos + SCREEN_ROWS )
{
const uint8_t fg = *dList -> ptrs[oldCursorPos] == ENT_TYPE_FILE ? 37:36
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(cursorPos-windowPos), CWIDTH, CHEIGHT, CLINELIMIT, consoleGetRGB565Color(33), &dList->ptrs[cursorPos][1] );
acf_draw( CLEFTMARGIN, LINENO_TO_Y(cursorPos-windowPos), CWIDTH, CHEIGHT, CLINELIMIT, consoleGetRGB565Color(3), &dList->ptrs[cursorPos][1] );
}
else {
//ee_printf("\x1b[%lu;H\x1b[0m>%.51s", cursorPos - windowPos, "<no gba rom>");