I want to implement an Input System. The current input system is not strong enough or easy to use so that I want to make a more powerful one.
- Key binding can be written in lua file. For example, “Move Horizontally” is binding to W / S. We use name to get the return value of input rather than get the return value by using W and S.
- Events. OnkeyDown, OnKeyUp, and more useful events.
- Use delegate function to bind into the getAxis functions.
- Caching user inputs or do key combos
How users use:
- When player press a certain key, a certain function should be called.
- Developer can create lua file to bind keys to some names like “Move Horizontally”.
- Some public function like
BindKey(const char* i_axisName, MyFunc i_callBackFunc, InputType i_inputType);
IsKeyDown(const char* i_axisName);
GetKey(const char* i_axisName);
GetKeyDown(const char* i_axisName);
Experiment and Challenge:
I am interested in doing delegate in c++, which makes me feel this feature is very cool. I have used both Unity and Unreal engine and they had very different input system. When I was using them, I felt like they had their own advantages and disadvantages. I wonder which one is better in which situations and if I can make a combined version of them and figure out “Oh that’s why they designed like this!”
Some challenge may be like how to do bind multiple keys with different events in one delegate functions. What’s the best way to cache inputs? What’s the best way to map and store the Name_Keys maps?