X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=common%2Fmenu.c;h=8accc2506530646e2ca228fc14df29e9dc85b389;hb=d5d59eb4793bb5ffaa880bc2dc67908ff824e201;hp=ded7bbcf734691ed263ae50a08d49c5bf80b9264;hpb=b188c2b6d0448a9c328a9dcae5ba5c8c8b5273f3;p=libpicofe.git diff --git a/common/menu.c b/common/menu.c index ded7bbc..8accc25 100644 --- a/common/menu.c +++ b/common/menu.c @@ -45,7 +45,7 @@ static const int me_sfont_w = 6, me_sfont_h = 10; // draws text to current bbp16 screen static void text_out16_(int x, int y, const char *text, int color) { - int i, l, u, tr, tg, tb, len; + int i, lh, tr, tg, tb, len; unsigned short *dest = (unsigned short *)g_screen_ptr + x + y * g_screen_width; tr = (color & 0xf800) >> 8; tg = (color & 0x07e0) >> 3; @@ -65,11 +65,17 @@ static void text_out16_(int x, int y, const char *text, int color) len = p - text; } + lh = me_mfont_h; + if (y + lh > g_screen_height) + lh = g_screen_height - y; + for (i = 0; i < len; i++) { unsigned char *src = menu_font_data + (unsigned int)text[i] * me_mfont_w * me_mfont_h / 2; unsigned short *dst = dest; - for (l = 0; l < me_mfont_h; l++, dst += g_screen_width - me_mfont_w) + int u, l; + + for (l = 0; l < lh; l++, dst += g_screen_width - me_mfont_w) { for (u = me_mfont_w / 2; u > 0; u--, src++) {