显示的页码有问题,添加探测代码

This commit is contained in:
anod 2022-10-16 10:06:40 +08:00
parent 217434b168
commit 1752701323

View File

@ -78,7 +78,7 @@ 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));
memset(consoleGet()->frameBuffer, 0xff, WINDOW_WIDTH*WINDOW_HEIGHT*sizeof(uint16_t));
if( ta[0] ) acf_put_text( 5, 215, WINDOW_WIDTH, WINDOW_HEIGHT, WINDOW_WIDTH-10, ATP_COLOR_CYAN, ATP_PLACEMENT_LEFT, ta );
if( tb[0] ) acf_put_text( 5, 215, WINDOW_WIDTH, WINDOW_HEIGHT, WINDOW_WIDTH-10, ATP_COLOR_CYAN, ATP_PLACEMENT_RIGHT, tb );
}
@ -183,14 +183,16 @@ static atp_error_t title_paint( atp_callerdata_t datain, atp_counter_t idx, atp_
return ATP_SUCCESS;
}
#define PAGING_BUFSIZE 32
static void set_paging( int top, int len )
{
screen_clean();
unsigned total = (len+CONTAINER_MAX_LINES-1) / CONTAINER_MAX_LINES;
unsigned current = top / CONTAINER_MAX_LINES;
char buf[TIPS_MAX];
ee_snprintf( buf, TIPS_MAX-1, "页码:%d/%d", current+1, total );
char buf[PAGING_BUFSIZE];
ee_snprintf( buf, PAGING_BUFSIZE-1, "页码:%d/%d", top, len );
buf[PAGING_BUFSIZE] = '\0';
atp_tips( buf, NULL );
}