Fixed slowdown due to drawing too many menu entries. Closes #84.

This commit is contained in:
yellows8 2019-06-17 18:56:38 -04:00
parent 6ec7388834
commit 85318335fb
No known key found for this signature in database
GPG Key ID: 0AF90DA3F1E60E43

View File

@ -614,6 +614,7 @@ void menuLoop(void) {
// Draw menu entries // Draw menu entries
for (me = menu->firstEntry, i = 0; me; me = me->next, i ++) { for (me = menu->firstEntry, i = 0; me; me = me->next, i ++) {
int entry_start_x = 29 + i * (140 + 30); int entry_start_x = 29 + i * (140 + 30);
int entry_draw_x = entry_start_x + menu->xPos;
int screen_width = 1280; int screen_width = 1280;
if (entry_start_x >= (screen_width - menu->xPos)) if (entry_start_x >= (screen_width - menu->xPos))
@ -624,7 +625,10 @@ void menuLoop(void) {
if (is_active) if (is_active)
active_entry = me; active_entry = me;
drawEntry(me, entry_start_x + menu->xPos, is_active); if (entry_draw_x < -(29 + 140 + 30))
continue;
drawEntry(me, entry_draw_x, is_active);
} }
int getX = GetTextXCoordinate(interuiregular18, 1180, textGetString(StrId_ThemeMenu), 'r'); int getX = GetTextXCoordinate(interuiregular18, 1180, textGetString(StrId_ThemeMenu), 'r');