为atp_show增加了上下滚动的处理

This commit is contained in:
anod 2022-09-26 14:09:32 +08:00
parent 7412e54b7e
commit a1076164cb
2 changed files with 24 additions and 8 deletions

View File

@ -91,7 +91,7 @@ static void paint_one_line( atp_lineinfo_t provider, acf_callerdata_t data, int
static void container_paint( atp_lineinfo_t provider, atp_callerdata_t data, atp_counter_t nlines, int top )
{
int end = top + CONTAINER_MAX_LINES;
if( end > nlines ) end = nlines;
if( end > (int)nlines ) end = nlines;
for( int n = top; n < end; ++n ){
paint_one_line( provider, data, n, n-top );
}
@ -100,16 +100,32 @@ static void container_paint( atp_lineinfo_t provider, atp_callerdata_t data, atp
atp_error_t atp_show( atp_counter_t cnt, atp_lineinfo_t provider, atp_callerdata_t data )
{
int idx_top = 0;
screen_clean();
container_paint( provider, data, cnt, idx_top );
while( 1 ){
screen_clean();
container_paint( provider, data, cnt, idx_top );
int top = idx_top;
u32 kDown = waitKey();
if( kDown == 0 ) return ATP_POWER_OFF;
if( kDown == KEY_B || kDown == KEY_A )
return ATP_SUCCESS;
if( kDown == KEY_B || kDown == KEY_A ) return ATP_SUCCESS;
else if( cnt > CONTAINER_MAX_LINES ){ // may scroll
if( kDown == KEY_UP || kDown == KEY_DUP ){
top = idx_top - 1;
}
else if( kDown == KEY_DOWN || kDown == KEY_DDOWN ){
top = idx_top + 1;
}
if( top+CONTAINER_MAX_LINES >= cnt ) top = cnt - 1 - CONTAINER_MAX_LINES;
else if( top < 0 ) top = 0;
}
else if( kDown == 0 ) return ATP_POWER_OFF;
if( top != idx_top ){
idx_top = top;
screen_clean();
container_paint(provider, data, cnt, idx_top);
}
}
}

View File

@ -526,7 +526,7 @@ static void gbaGfxHandler(void *args)
}
GX_processCommandList(listSize, list);
GFX_waitForP3D();
// 地址0x18180000保存的是360x240大小的贴图数据
// 地址0x18180000保存的是360x240大小的贴图数据rgb888
// 地址0x18200000保存的是512x512大小的GBA的240x160贴图数据
GX_displayTransfer((u32*)(0x18180000 + (16 * 240 * 3)), 368u<<16 | 240u,
GFX_getFramebuffer(SCREEN_TOP) + (16 * 240 * 3), 368u<<16 | 240u, 1u<<12 | 1u<<8);