%
% Keyboard mapping for SR22.
%

key_press = [
  % Numeric keypad without NumLock.
  Prior            set(dDP_0, +0.8)
  Next             set(dDP_0, -0.8)
  '9'              set(dDP_0, +0.8)
  '3'              set(dDP_0, -0.8)
  Left             set(dDA, -0.8)
  Right            set(dDA, +0.8)
  '4'              set(dDA, -0.8)
  '6'              set(dDA, +0.8)
  Up               set(dDE, -0.8)
  Down             set(dDE, +0.8)
  '8'              set(dDE, -0.8)
  '2'              set(dDE, +0.8)
  Insert           set(dDR, -0.8)
  '0'              set(dDR, -0.8)
  Enter            set(dDR, +0.8)
  Shift Left       set(dDR, -0.8)
  Shift Right      set(dDR, +0.8)
  Home             set(dDE_T, -0.8)
  End              set(dDE_T, +0.8)
  Shift Up         set(dDE_T, -0.8)
  Shift Down       set(dDE_T, +0.8)

  % 'Clear' is the 5 in the center of the keypad.
  Clear            set(DA, 0)
  Clear            set(DR, 0)
  Clear            set(dDA, 0)
  Clear            set(dDR, 0)
  '5'              set(DA, 0)
  '5'              set(DR, 0)
  '5'              set(dDA, 0)
  '5'              set(dDR, 0)


  % Keys on the normal keyboard.
  BracketLeft      add(DF, -.2, 0, 1)
  BracketRight     add(DF,  .2, 0, 1)
  Shift F          add(DF, -.2, 0, 1)
  F                add(DF,  .2, 0, 1)
  Comma            set(DB_0, 1)
  Period           set(DB_1, 1)
  C                set(DA, 0)
  C                set(DR, 0)

  % Freeze/Pause
  Space            toggle(TotalFreeze)
  H                toggle(HUDEnabled)
  H                toggle(ControlsIndicationEnabled)
  % Fast movement
  % 10 degrees
  Ctrl Up          add(VAngle, +0.174533)
  Ctrl Down        add(VAngle, -0.174533)
  % 45 degrees
  Ctrl Left        add(HAngle, -0.785398)
  Ctrl Right       add(HAngle, +0.785398)
  % Slow movement
  Alt Up           set(dVAngle, +0.1)
  Alt Down         set(dVAngle, -0.1)
  Alt Left         set(dHAngle, -0.1)
  Alt Right        set(dHAngle, +0.1)
  V                set(HAngle, 0)
  V                set(VAngle, 0)
  V                set(dHAngle, 0)
  V                set(dVAngle, 0)
]
