This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
en:tutorials:remapping_inputs [2018/02/21 02:48 (6 years ago)] – sausage | en:tutorials:input:remapping_inputs [2020/08/31 14:11 (4 years ago)] (current) – ↷ Links adapted because of a move operation 76.14.89.164 | ||
---|---|---|---|
Line 1: | Line 1: | ||
====== Remapping Controller Inputs ====== | ====== Remapping Controller Inputs ====== | ||
- | Joystick buttons, mouses button or keyboard keys can be mapped. These bindings can be removed in code and rebound. This is especially useful in games where the user is allowed to customise their own keys. It is also handy in terms of gamepads where there is little standard between manufacturers. | + | Joystick buttons, mouses button or keyboard keys can be mapped. These bindings can be removed in code and rebound. This is especially useful in games where the user is allowed to customise their own keys or changing what joystick button or stick operates what control. |
This article is more a presentation of a remapping routine rather than a step by step tutorial. | This article is more a presentation of a remapping routine rather than a step by step tutorial. | ||
+ | |||
+ | <WRAP center round info 90%> | ||
+ | If you wish to simply use the existing built-in mappings for all controllers, | ||
+ | </ | ||
+ | |||
It introduces the use of the following functions: | It introduces the use of the following functions: | ||
Line 13: | Line 18: | ||
* '' | * '' | ||
- | The routine will allow the user to press any key or joystick button assigned to the '' | + | The routine will allow the user to press any key or joystick button assigned to the '' |
Starting with the input config: | Starting with the input config: | ||
Line 20: | Line 25: | ||
[MainInput] | [MainInput] | ||
KEY_ESCAPE | KEY_ESCAPE | ||
- | KEY_RETURN = Remap | + | KEY_ENTER = Remap |
JOY_12_1 = XButton ;Joystick binding | JOY_12_1 = XButton ;Joystick binding | ||
KEY_X = XButton ;Keyboard alternative | KEY_X = XButton ;Keyboard alternative | ||
</ | </ | ||
- | In the above config, the '' | + | In the above config, the '' |
Then there are two controls mapped to '' | Then there are two controls mapped to '' | ||
Line 85: | Line 90: | ||
First, if either '' | First, if either '' | ||
- | Next, remap mode can be entered by pressing the '' | + | Next, remap mode can be entered by pressing the '' |
In remap mode, '' | In remap mode, '' | ||
- | '' | + | '' |
- | We then loop through the entire list looking for any joystick button type input and unbind '' | + | We then loop through the entire list looking for any joystick button type input and unbind '' |
'' | '' | ||
Line 98: | Line 103: | ||
Finally remap mode is turned off, and if you press the new joystick button that you chose, it will start to log to console instead of the previous joystick button. | Finally remap mode is turned off, and if you press the new joystick button that you chose, it will start to log to console instead of the previous joystick button. | ||
+ | |||
+ | |||
+ | <WRAP center round tip 90%> | ||
+ | **Note:** when using '' | ||
+ | </ |