Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
performance, Sdl2Input, PumpInput #17520
PumpEvents seems to be called each frame. Most of the time SDL_PollEvent will not return any input events, since the user has not generated them.
The MakeModifiers and inputHandler.ModifierKeys however is always called each time PumpInput is called. Since it seems that pressing a modifier key will result also in an event it would best to initialize the modifier only once when at least one event was polled. I.e. to set the modifiers inside the PollEvent while loop (once).
This avoids both functions being always called in PumpInput (each Frame) without the resulting value being used or the value having been changed.
(Also the MakeModifiers method is quite expensive considering it only maps an SDL modifier to an RA modifier which are basically similar. Why not make the types/enum values equal and be able to cast the modifier flags.)