gorbit99 / olcPGEX_Gamepad

Cross platform (Windows + Linux) Gamepad API for the Pixel Game Engine (http://onelonecoder.com/)
Other
15 stars 5 forks source link

Use the inotify API on linux to improve performance #5

Closed PythonJedi closed 3 years ago

PythonJedi commented 3 years ago

Now the gamepad extension only iterates over each input device when initialized or when there's an error while reading the inotify events. Any new input device is queried whether it's a gamepad and added if it is one every frame, so we still have plug-n-play equivalent to Windows and Emscripten.

On my system this takes the gamepad example from 20-30 FPS to 1000-1500 FPS without any optimization. With -O3, it goes from 40-50 FPS to 2000-3000 FPS.