TomGrobbe / MenuAPI

FiveM C# Menu API. Designed specifically as a replacement of NativeUI for vMenu. Full safezone scaling supported, both left and right aligned menus supported.
https://docs.vespura.com/mapi
61 stars 46 forks source link

Minor optimizations and fix lines being cut when newlines are in the string #43

Open niekschoemaker opened 2 years ago

niekschoemaker commented 2 years ago

Listening to the Menu Keys seems unecessary when the key is 0, and this thread uses quite a bit of resources with the native calls, so simply returning when the key is zero seems like a good options here.

The other commit changes the line split to a regex, this might be more performant (haven't tested that), but the main point with this is that if new lines are in the string it would still cut off the string, that seems unecessary, this fixes that by also seeing new lines as whitespace characters and replacing the new line with a new line giving you more control over where the new lines are.