From 85318335fb40977168240c6f83fedcba32544c5d Mon Sep 17 00:00:00 2001 From: yellows8 Date: Mon, 17 Jun 2019 18:56:38 -0400 Subject: [PATCH] Fixed slowdown due to drawing too many menu entries. Closes #84. --- common/menu.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/common/menu.c b/common/menu.c index 3a2dc90..e6b8b70 100644 --- a/common/menu.c +++ b/common/menu.c @@ -614,6 +614,7 @@ void menuLoop(void) { // Draw menu entries for (me = menu->firstEntry, i = 0; me; me = me->next, i ++) { int entry_start_x = 29 + i * (140 + 30); + int entry_draw_x = entry_start_x + menu->xPos; int screen_width = 1280; if (entry_start_x >= (screen_width - menu->xPos)) @@ -624,7 +625,10 @@ void menuLoop(void) { if (is_active) 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');