Fix menu scrolling in SDL while emulating SGB

This commit is contained in:
Lior Halphon 2020-01-29 20:55:17 +02:00
parent 48d3504de7
commit ce5153544c

View File

@ -180,6 +180,7 @@ static void draw_unbordered_text(uint32_t *buffer, unsigned width, unsigned heig
{ {
y -= scroll; y -= scroll;
unsigned orig_x = x; unsigned orig_x = x;
unsigned y_offset = (GB_get_screen_height(&gb) - 144) / 2;
while (*string) { while (*string) {
if (*string == '\n') { if (*string == '\n') {
x = orig_x; x = orig_x;
@ -188,7 +189,7 @@ static void draw_unbordered_text(uint32_t *buffer, unsigned width, unsigned heig
continue; continue;
} }
if (x > width - GLYPH_WIDTH || y == 0 || y > height - GLYPH_HEIGHT) { if (x > width - GLYPH_WIDTH || y == 0 || y - y_offset > 144 - GLYPH_HEIGHT) {
break; break;
} }