User Tools

Site Tools


en:tutorials:remapping_inputs

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
en:tutorials:remapping_inputs [2018/08/27 22:20 (24 months ago)]
sausage Note on core clocks
en:tutorials:remapping_inputs [2018/09/28 14:53 (23 months ago)] (current)
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,​ [[en:​tutorials:​analog_joystick_gamepad_control|check this article first]]. If you wish to learn about additional standard mappings for all controllers,​ see [[en:​tutorials:​overriding_controller_mapping|Overriding a Controller mapping]].
 +</​WRAP>​
 +
  
 It introduces the use of the following functions: It introduces the use of the following functions:
Line 13: Line 18:
   * ''​orxInput_Save'' ​   * ''​orxInput_Save'' ​
  
-The routine will allow the user to press any key or joystick button assigned to the ''​XButton''​ label in order to trigger a message to the console. They press the ''​Return''​ key to enter remap mode. Then pressing any joystick button will make the button the new one assigned to ''​XButton''​.+The routine will allow the user to press any key or joystick button assigned to the ''​XButton''​ label in order to trigger a message to the console. They press the ''​Enter''​ key to enter remap mode. Then pressing any joystick button will make the button the new one assigned to ''​XButton''​.
  
 Starting with the input config: Starting with the input config:
Line 20: Line 25:
 [MainInput] [MainInput]
 KEY_ESCAPE ​     = Quit KEY_ESCAPE ​     = Quit
-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
 </​code>​ </​code>​
  
-In the above config, the ''​Escape''​ key is used as the usual quit key and the ''​Return''​ key is the one used to put our game into "remap mode".+In the above config, the ''​Escape''​ key is used as the usual quit key and the ''​Enter''​ key is the one used to put our game into "remap mode".
  
 Then there are two controls mapped to ''​XButton'',​ ''​JOY_12_1''​ which is the 12th button on your joystick controller or gamepad, and secondly, the ''​X''​ key. Then there are two controls mapped to ''​XButton'',​ ''​JOY_12_1''​ which is the 12th button on your joystick controller or gamepad, and secondly, the ''​X''​ key.
Line 85: Line 90:
 First, if either ''​Joystick button 12''​ or the ''​X''​ key is pressed, a line is logged to the console. First, if either ''​Joystick button 12''​ or the ''​X''​ key is pressed, a line is logged to the console.
  
-Next, remap mode can be entered by pressing the ''​Return''​ key.+Next, remap mode can be entered by pressing the ''​Enter''​ key.
  
 In remap mode, ''​orxInput_GetActiveBinding''​ is constantly called. This will get the very last input that was made whether it be a key, a mouse movement, a joystick press, etc. Here, if it was a joystick press, store it for later, and it will be used as the button to remap to. In remap mode, ''​orxInput_GetActiveBinding''​ is constantly called. This will get the very last input that was made whether it be a key, a mouse movement, a joystick press, etc. Here, if it was a joystick press, store it for later, and it will be used as the button to remap to.
en/tutorials/remapping_inputs.1535408448.txt.gz ยท Last modified: 2018/08/28 01:20 (24 months ago) (external edit)