Comments (13)
@Guad
Did some measurements:
- FPS /w no menu onscreen: 82-85FPS
- FPS /w menu onscreen: 50-55 FPS
- FPS /w menu onscreen, DisEnableControls commented out: 74-76 FPS
- FPS /w menu onscreen, input group 2 only: 65-66 FPS
Turns out the foreach (var con in Enum.GetValues(typeof(Control)))
in DisEnableControls is responsible for about ~20FPS from the total ~30FPS drop when having the menu open. Not sure how you'd replace this "block everything", but removing the 0 and 1 helps a tiny bit. Only disabling a small set of controls would be even better.
Not sure where the 10 FPS drop comes from exactly, as measuring the impact of the string splittage isn't very conclusive.
Edit -
Replacing that loop with this results in the same behavior, but no FPS drop.
Function.Call(enable ? Hash.ENABLE_ALL_CONTROL_ACTIONS : Hash.DISABLE_ALL_CONTROL_ACTIONS, 2);
Credits to @kagikn for the quick thinking.
from nativeui.
I think this happens when attaching the tick event to MenuPool.ProcessMenus(). I tried setting the Interval to 100ms and faced the menu flashes all along. Even just calling Yield() after MenuPool.ProcessMenus() causes this. Why does the menu disappear in-between anyway? If that wouldn't be the case we wouldn't have those issue, I'm pretty sure.
from nativeui.
That's because with the Draw() method of the menus draws the sprites and text for one frame, so you'd have to call it every frame. If you set the interval too big, it draws it every other frame, which causes the flicker.
from nativeui.
Got that but isn't there any other way? I mean, the menu functionality of scripthookvdotnet doesn't have this problem. Maybe you can get an idea if you check out the source code of V1.1 and have a look at it. ;-)
from nativeui.
This menu uses the same functionality, except that the old scripthookvdotnet menu was much simpler and didn't use any sprites, so it was easy on the performance.
from nativeui.
How about always pausing the game at menu popup? Do you also need to redraw with each frame then?
from nativeui.
Yes, it's how the game implements sprites, there's no way around that.
from nativeui.
directx hooking maybe? but that'd take a near complete (if not complete) rewrite
from nativeui.
@ardaozkal That'd obscure game items such as the mouse pointer and other stuff.
from nativeui.
ScriptHookV uses it's own drawTexture instead of the DRAW_SPRITE native. Would using that help?
Also, would drawing in a different thread help? Not sure if you can do this with respect to GTAs threads.
nvm this all, doesn't make sense.
from nativeui.
@E66666666 I also noticed shv's drawTexture lags behind a frame. Not sure if it's just me or...
from nativeui.
Actually, Tanjitsu found Enum.GetValues
in DisEnableControls
(named as EnableControls
in the shvdn3 branch) killed huge FPS before I did.
Didn't noticed that when I made my PR, though.
from nativeui.
Well shit, now it looks kinda obvious. Thanks again.
from nativeui.
Related Issues (20)
- Add AppVeyor support for creating automatic NativeUI builds HOT 2
- GoLeft and GoRight doesn't check if the item is disabled or not
- How can I fix this? HOT 1
- Move the repository into an Organization HOT 7
- how to debug HOT 2
- Submenu within a submenu HOT 1
- With NativeUI.dll police dont attack me at all (GTA 5 - Epic Games Version 1.0.1868.4) HOT 2
- .OnListChanged being weird HOT 1
- Menu not work when using example code HOT 3
- help please! HOT 1
- List changes element too fast HOT 1
- Native UI compatibility for ScriptHookVDotNet3? HOT 7
- Deprecation of NativeUI HOT 1
- I cant define InstructionalButton using ScriptHookVDotNetV3 HOT 2
- Help me
- comment l'installer HOT 1
- NativeUI HOT 1
- I have downloaded a vehicle extra menu and the reqiurements are nativeui but when in server i press E to honk my horn and my screen starts spinning and has the native ui menu on my screen HOT 1
- Error HOT 1
- Can you write a NativeUI in C++? HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from nativeui.