There are two options any game system has when it wants to react to user input. In the simplest form, the code will listen to a specific input event, such as the user pressing the Space bar on the keyboard. Whenever this event is received, the code can react with the appropriate response, for example by making the player character jump.
This direct link between a key on the keyboard and a reaction in the game world is very straightforward, but also very limited. The code will need to check whether the player character is currently allowed to jump. Triggering jumps might need to be prevented during a cut-scene, while in a vehicle, or when a menu is currently shown.
Also, nowadays it is customary to allow players to customize the keyboard layout. The key to trigger a jump might not be the Space bar after the player has personalized the controls and the code responding to the input event needs to account for that.
In addition to keyboard input, many games also offer support for game...