unit gameplay;

interface
uses
  objet,
  System.Drawing,
  System.Windows.Forms,
  Microsoft.DirectX,
  Microsoft.DirectX.DirectInput,
  Microsoft.DirectX.Direct3D;

type
  TTouches = record
    Ha,ba,Dr,Ga,R,saut : boolean;
  end;

  TGameP = class
    private

    public
      Touches : TTouches;
      keyboard : Microsoft.DirectX.DirectInput.Device;
      constructor Create;
//      procedure initilize;
      procedure GetEnter (var move : TMove ; var Touches : TTouches);
  end;

implementation

constructor TGameP.Create;
begin
  inherited;
end;

//procedure TGameP.initilize;
//begin
//    Self.keyboard := Microsoft.DirectX.DirectInput.Device.Create(SystemGuid.keyboard);
//    Self.keyboard.SetCooperativeLevel(Self, (CooperativeLevelFlags.Background
//                                       or CooperativeLevelFlags.NonExclusive));
//    Self.keyboard.SetDataFormat(DeviceDataFormat.Keyboard);
//    Self.keyboard.Acquire;
//end;

procedure TGameP.GetEnter (var move : TMove ; var Touches : TTouches);
var
  keys: KeyboardState;                          
begin
  keys := Keyboard.GetCurrentKeyboardState;
    if keys[Key.Right] then
      Touches.Dr := True
    else
      Touches.Dr := false;

  keys := Keyboard.GetCurrentKeyboardState;
    if keys[Key.Left] then
      Touches.Ga := True
    else
      Touches.Ga := false;

  keys := Keyboard.GetCurrentKeyboardState;
    if keys[Key.Up] then
      Touches.Ha := True
    else
      Touches.Ha := false;

  keys := Keyboard.GetCurrentKeyboardState;
    if keys[Key.Down] then
      Touches.ba := True
    else
      Touches.ba := false;

        keys := Keyboard.GetCurrentKeyboardState;
    if keys[Key.R] then
      Touches.R := True
    else
      Touches.R := false;

        keys := Keyboard.GetCurrentKeyboardState;
    if keys[Key.Space] then
      Touches.saut := True
    else
      Touches.saut := false;

end;

end.
