haekb / nolf2-modernizer

NOLF 2 Modernizer aims to unlock resolution support, restore multi-player support, and fix a few bugs here and there.
https://haekb.itch.io/nolf2-modernizer
30 stars 4 forks source link

Add keyboard events to GameInputMgr #77

Closed haekb closed 3 years ago

haekb commented 4 years ago

Related to #75

So I can't really fix the "IsCommandOn" getting stuck between menus, but I can expand my GameInputMgr to include keyboard events. Hopefully I can just plug in the engine's "OnKeyDown/Up" events to it.

haekb commented 4 years ago

This ended up being fairly easy for the gameplay part of it, but annoying for the configure controls screen.

First off this is a giant work-around. The game now has two(!) event loops. The standard C++ event loop that is handled in the engine somewhere, and an SDL2 one in our GameInputMgr. As it turns out DirectInput uses physical keys rather than virtual keys. So I ended up creating a map of direct conversions (DirectInput key codes to SDL2 key codes) and basing everything from there.

I've also tried to make the changes in ScreenConfigure pretty modular. So that when someone eventually pokes into the engine side of things, they can easily throw away my changes.

Still needs some clean up though!