Results 1 to 8 of 8

Thread: Joystick buttons don't work?

  1. #1

    Joystick buttons don't work?

    I just tried to implement joystick support and found (not suprised) that it doesn't work very well.
    OK.. so the axis are screwed on the movement and forcefeedback doesn't work.. I can fix the axis and lose the FF, but... erm. NO BUTTONS WORK!

    Anyone successfully using a joystick with DelphiX ?

    thanks

  2. #2

    Joystick buttons don't work?

    FFB doesn't work with delphix at the moment anyway.

    But buttons should definately work, and, for axis I use:

    if (mainfm.DXInput1.Joystick.Joystate.rgdwPOV[0]=0)then
    begin


    This will be UP direction with digital ON.

    Other values (for the =0 part) are then 18000, 27000, 9000 for other directions, and yes values for diagonals are there too. I forget but I think 4500 is one, then half way between 9000 and 18000 so on so on so on

    But should you not want digital anyway, it won't matter because as I say, FFB is not even working at the moment for delphix

    Show me some of your code

  3. #3

    Joystick buttons don't work?

    I tried the joystick sample from Cerebral Bicycle, as well as the joystick samples that come with DelphiX.

    Joystick.ButtonCount returns 16, but all buttons return false at all times!?

    This is using a PS2 controller with the USB interface (it does work ok on other stuff).

    I also have a Saitek X52 and a Logitec steering wheel I can try to eliminate the PS2 controller from the problem - but I REALLY want the PS2 controller because it is ideally suited to the game I`m making (Robotron).

    Cheers

  4. #4

    Joystick buttons don't work?

    i use a ps2 controller also using joybox 5

    now, show me the code you are using. to check if normal axis are input you do:

    if (isup in dxinput1.states)then
    begin
    ...movement here for up....

    also, make sure at the start of your code in the timer (ontimer) you have dxinput1.update;

    for buttons 1 to 12 on a ps2 joypad it is the same:

    isbutton1 in dxinput1.states for triangle for example

    this UPDATES the states, without it, the code is as good as useless

  5. #5

    Joystick buttons don't work?

    This is in the timer:


    Code:
    for i := 0 to DXInput1.Joystick.ButtonCount do
    begin
         if DXInput1.Joystick.Buttons[i] = True then
         begin
              str(i,StrVal);
              MessageDlg(StrVal,mtInformation,[mbOK] ,0);
         end;
    end;
    DXInput1.Joystick.Buttons[i] doesn't work, and just use DXInput1.States?
    OK.. I`ll try now...

    OK, dxinput1.update is there of course.
    Even Hori example doesn't work (button1). Movement works (wrong directions, but can be fixed)
    Maybe I have a bad DXInput.pas file?

  6. #6

    Joystick buttons don't work?

    Duh!!

    The property "UseDirectInput" should be false.. then everything works! (except FFB.. but what the hell)

  7. #7

    Joystick buttons don't work?

    yeah the code you are using also works, but isbutton1 etc does the same thing. I guess your way is better in other circumstances too

    And yeah, i was about to make sure you had that set right

  8. #8

    Joystick buttons don't work?

    Yes, All is good now.

    It was kind of an afterthought to set that property, as when I looked thru the DXInout code, I see that DX isn't used for the joystick!!!

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
  •