Page 1 of 1

Joystick Axis

Posted: Thu Jan 29, 2015 6:00 am
by StarBootics
Hello,

In the current Joystick library, we have nothing to get information about the 4th axis (most often the throttle or "R" axis)
It's a serious limitation for the moment.

Best regards
StarBootics

Re: Joystick Axis

Posted: Thu Jan 29, 2015 9:52 am
by Bananenfreak
What´s this 4th axis?
I don´t know how to use 3, because there´s X and Y or Z, because down- or upward is a button.

Re: Joystick Axis

Posted: Thu Jan 29, 2015 1:35 pm
by STARGÅTE
On current game pads you have up to 6 axes:
X, Y, Z, R, U, V
http://team358.org/files/programming/Co ... apping.jpg

With Win-API it is possible to use all this axes, so you can use this incldue for example:
Joystick v1.0, Windows, 6 axes, 32 button, POV, deadzones

Re: Joystick Axis

Posted: Thu Jan 29, 2015 5:40 pm
by StarBootics
For a Joystick like this one :

Image

X axis
Y axis
Z axis
Slider axis (Throttle)

Best regards
StarBootics

Re: Joystick Axis

Posted: Thu Jan 29, 2015 6:15 pm
by heartbone
The stars came out!
StarBootics wrote:Image
That's a good example picture StarBootics. So is yours STARGÅTE.
They illustrate the main problem which is,
if the developers decided to extend support to include that range of inputs,
then you'd likely need to send the developers the actual stick to get it supported,
as there are so many configurations.

The actual standard can be found here and that seems to be what the team implemented for the last upgrade.
There is still significant variation within the implementations of the recently finalized standard.
Of course, the XBOX and PlayStation console variants are very popular,
but The Logitech Dual Action is my recommendation based on the information presented in this thread.
Characteristically, Microsoft keeps on changing the specs on their controllers. :evil:
For example the 360 controller <> XBone controller.
Sony on the other hand is a lot more reasonable and considerate.
In this area I feel the history needs to be examined to make a better evaluation for future plans.
Which type of controller(s) are being supported with the current mapping?
It would be nice to know.

Unfortunately for Logitech, and Sony, and most of the low end generic controller manufacturers,
it looks like the main 4 XBOX buttons (A B X Y) conform to the new standards.
Or is it the other way around?

Re: Joystick Axis

Posted: Thu Jan 29, 2015 11:56 pm
by Saboteur
I can acess to all buttons, joysticks and triggers in my xbox controller. Only have to select PAD in function -> JoystickAxisX(#Joystick [, Pad [, Mode]])

Example:

Code: Select all

NbJoysticks = InitJoystick() 

If NbJoysticks = 0
  MessageRequester("Error", "No joysticks are availables.", 0)
  End
EndIf

If OpenWindow(0, 100, 100, 300, 500, "PureBasic - Joystick Demo")
  TextGadget(1,0,0,150,500,"")

  Repeat
  
    Repeat
      Event = WindowEvent()
      If Event = #PB_Event_CloseWindow : Quit = 1 : EndIf
    Until Event = 0

    Delay(20) ; a little delay (20 milli seconds -> 50 fps)
  
    If ExamineJoystick(0)
      result.s=JoystickName(0)+#CRLF$
      For f=1 To 16
        result+"Botón "+Str(f)+": "+Str(JoystickButton(0,f))+#CRLF$
      Next f
      For f=0 To 2
        result+"Eje X"+Str(f+1)+": "+JoystickAxisX(0,f,#PB_Relative)+#CRLF$
        result+"Eje Y"+Str(f+1)+": "+JoystickAxisY(0,f,#PB_Relative)+#CRLF$
        result+"Eje Z"+Str(f+1)+": "+JoystickAxisZ(0,f,#PB_Relative)+#CRLF$
      Next f
      SetGadgetText(1,result)
      
    EndIf

  Until Quit = 1

EndIf

End
Is that what you mean?

Re: Joystick Axis

Posted: Sat Jan 31, 2015 6:26 am
by StarBootics
Hello everyone,

A command to get the information about the Hat Switch (8 states button) can be useful as well.

Best regards
StarBootics

Re: Joystick Axis

Posted: Sat Jan 31, 2015 11:02 am
by Bananenfreak
@ Stargate:
As Saboteur said, this is already implemented. And there are only 2 axis!

@Starbootics:
Do you test it with a program before posting your request?
I´m sure you can use your Joystick. I only see 2 pads. One with 3 axis and one with 1 axis(?).

I don´t want to write a program for it, but you could use my Epos Worldeditor for it.
It supports up to 4 Joysticks. I think it´s in german, so do this "Datei --> Optionen --> Allgemein ---> Sprache" now choose English and restart the program.
Now go in Options and try your Joystick

EDIT: "Hat" is also a pad. It´s a digital pad (Digipad) with 9 states.

Re: Joystick Axis

Posted: Sat Jan 31, 2015 6:14 pm
by StarBootics
@Bananenfreak

You should take a look at http://wiki.libsdl.org/CategoryJoystick

Best regards
StarBootics

Re: Joystick Axis

Posted: Sun Feb 01, 2015 9:00 am
by Bananenfreak
@StarBootics:

What should I read there? You should take a look at http://www.purebasic.com/documentation/ ... index.html
I don´t have a Joystick, but I´m sure your "Hat Switch" in PB is only a third pad. Did you test it?