修正计算title行数不正确的bug

This commit is contained in:
anod 2022-10-13 23:38:21 +08:00
parent 20eb7a87eb
commit a2ba5087f2

View File

@ -42,6 +42,7 @@ const char *acf_put_text(int x, int y, int width, int height, int maxwidth, u8 c
acf_rectedge_t realwid;
acf_canvas_t canvas = acf_get_canvas(maxwidth, text, &realwid, NULL, &retval);
if( !canvas ) return retval;
if( placement == ATP_PLACEMENT_RIGHT ) draw_data_int[0] += maxwidth - realwid;
else if( placement == ATP_PLACEMENT_CENTER ) draw_data_int[0] += (maxwidth-realwid) >> 1;
acf_recycle( acf_use_canvas(canvas, 1, set_screen_color, draw_data) );
@ -219,7 +220,7 @@ atp_error_t atp_select( atp_text_t title, atp_counter_t cnt, atp_itemprovider_t
for( int i=0; i < TITLE_MAX; ++i )
{
const char *next = easy_put( cursor, ATP_PLACEMENT_LEFT, ATP_COLOR_WHITE, i );
if( next == NULL ) break;
if( *next == '\0' ) break;
title_offset[i] = next - cursor;
++title_len;