The in-game input processing system consists of CInputManager and CInputComponent. It functions using the keyboard and mouse input states, along with the structures that bind these inputs. Each object binds the inputs it needs, and executes the corresponding callback functions in response to the inputs received.
The key advantage of this system is that it can handle multiple callback functions by combining various input conditions (input value + input state) for keyboard and mouse, allowing flexible design and extension of input configurations.
This utility defines common types and structures needed for managing keyboard and mouse inputs, input states, and event bindings, which are essential for in-game input processing.
1. EKeyAction Enum Class
enum class EKeyAction : unsigned char{ PRESS, HOLD, RELEASE, MAX};
Enum class used to distinguish different types of key inputs.
Registers input conditions (input values and states) and callback functions in mBinders per object, and executes the callbacks when the conditions are met.
Key Variable:
mBinders:
Each FBinder is stored with a string key, and each binder stores input conditions (input values and states) and callback functions.
Registers input conditions to mBinders based on string keys.
Conclusion
Through this implementation, I learned that separating the CInputManager and CInputComponent allows for clean handling of custom key mappings, various input patterns, and complex input conditions. Additionally, it provided a deep understanding of how to design the input system in a flexible and extensible manner.