Results 1 to 3 of 3

Thread: Problem with joystick axes on delphiX

  1. #1

    Problem with joystick axes on delphiX

    Please help,

    I use delphi X directinput for joystick control. When I read the values from my joystick I see that axes are switched. So the Y value is read at the dijoystate2.IZ and the X value is nowhere. As soon as I set the property UseDirectInput to false, the axes are OK. But then I can't use for example the torsion of the joystick handle. Who can help me out?

    This is how I read the values (via a timer):

    Code:
    procedure TForm6.DXTimer1Timer(Sender: TObject; LagCount: Integer);
    var
      js : Tdijoystate2;
    begin
      dxinput1.Update;
      js := dxinput1.Joystick.Joystate;
      lb.Clear;
      lb.AddItem('IX' + inttostr(js.lX), nil);
      lb.AddItem('IY' + inttostr(js.lY), nil);
      lb.AddItem('IZ' + inttostr(js.lZ), nil);
      lb.AddItem('IRx' + inttostr(js.lRx), nil);
      lb.AddItem('IRy' + inttostr(js.lRy), nil);
      lb.AddItem('IRZ' + inttostr(js.lRZ), nil);
      lb.AddItem('IVx' + inttostr(js.lVX), nil);
      lb.AddItem('IVy' + inttostr(js.lVy), nil);
      lb.AddItem('IVZ' + inttostr(js.lVz), nil);
      lb.AddItem('IVRx' + inttostr(js.lVRx), nil);
      lb.AddItem('IVRy' + inttostr(js.lVRy), nil);
      lb.AddItem('IVRz' + inttostr(js.lVRz), nil);
      lb.AddItem('IAx' + inttostr(js.lAX), nil);
      lb.AddItem('IAy' + inttostr(js.lAy), nil);
      lb.AddItem('IAz' + inttostr(js.lAz), nil);
      lb.AddItem('IARx' + inttostr(js.lARx), nil);
      lb.AddItem('IARy' + inttostr(js.lARy), nil);
      lb.AddItem('IARz' + inttostr(js.lARz), nil);
      lb.AddItem('IFx' + inttostr(js.lFX), nil);
      lb.AddItem('IFy' + inttostr(js.lFy), nil);
      lb.AddItem('IFz' + inttostr(js.lFz), nil);
      lb.AddItem('IFRx' + inttostr(js.lFRx), nil);
      lb.AddItem('IFRy' + inttostr(js.lFRy), nil);
      lb.AddItem('IFRz' + inttostr(js.lFRz), nil);
      lb.AddItem('rglslider0' + inttostr(js.rglSlider[0]), nil);
      lb.AddItem('rglslider1' + inttostr(js.rglSlider[1]), nil);
      lb.AddItem('rglVslider0' + inttostr(js.rglVSlider[0]), nil);
      lb.AddItem('rglVslider1' + inttostr(js.rglVSlider[1]), nil);
      lb.AddItem('rglAslider0' + inttostr(js.rglASlider[0]), nil);
      lb.AddItem('rglAslider1' + inttostr(js.rglASlider[1]), nil);
      lb.AddItem('rglFslider0' + inttostr(js.rglFSlider[0]), nil);
      lb.AddItem('rglFslider1' + inttostr(js.rglFSlider[1]), nil);
    
    end;
    lb is a listbox on a form that I fill with the actual values of the joystick.

    Richard

  2. #2

    Problem with joystick axes on delphiX

    Joystate? Have you tried dxinput1.Joystick.X , dxinput1.Joystick.Y and so on? Like dx keyboard i hardly ever use keyboard.states. Commonly those states are defined clicking the TXDInput component on form.

  3. #3

    Problem with joystick axes on delphiX

    This gives me the same problem. The axes are stil wrong.

    Richard

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •