Joystick Axis

Got an idea for enhancing PureBasic? New command(s) you'd like to see?
User avatar
StarBootics
Addict
Addict
Posts: 984
Joined: Sun Jul 07, 2013 11:35 am
Location: Canada

Joystick Axis

Post 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
The Stone Age did not end due to a shortage of stones !
User avatar
Bananenfreak
Enthusiast
Enthusiast
Posts: 519
Joined: Mon Apr 15, 2013 12:22 pm

Re: Joystick Axis

Post 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.
Image
User avatar
STARGÅTE
Addict
Addict
Posts: 2067
Joined: Thu Jan 10, 2008 1:30 pm
Location: Germany, Glienicke
Contact:

Re: Joystick Axis

Post 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
PB 6.01 ― Win 10, 21H2 ― Ryzen 9 3900X, 32 GB ― NVIDIA GeForce RTX 3080 ― Vivaldi 6.0 ― www.unionbytes.de
Lizard - Script language for symbolic calculations and moreTypeface - Sprite-based font include/module
User avatar
StarBootics
Addict
Addict
Posts: 984
Joined: Sun Jul 07, 2013 11:35 am
Location: Canada

Re: Joystick Axis

Post by StarBootics »

For a Joystick like this one :

Image

X axis
Y axis
Z axis
Slider axis (Throttle)

Best regards
StarBootics
The Stone Age did not end due to a shortage of stones !
User avatar
heartbone
Addict
Addict
Posts: 1058
Joined: Fri Apr 12, 2013 1:55 pm
Location: just outside of Ferguson

Re: Joystick Axis

Post 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?
Keep it BASIC.
Saboteur
Enthusiast
Enthusiast
Posts: 271
Joined: Fri Apr 25, 2003 7:09 pm
Location: (Madrid) Spain
Contact:

Re: Joystick Axis

Post 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?
[:: PB Registered ::]

Win10 Intel core i5-3330 8GB RAM Nvidia GTX 1050Ti
User avatar
StarBootics
Addict
Addict
Posts: 984
Joined: Sun Jul 07, 2013 11:35 am
Location: Canada

Re: Joystick Axis

Post 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
The Stone Age did not end due to a shortage of stones !
User avatar
Bananenfreak
Enthusiast
Enthusiast
Posts: 519
Joined: Mon Apr 15, 2013 12:22 pm

Re: Joystick Axis

Post 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.
Last edited by Bananenfreak on Sun Feb 01, 2015 9:01 am, edited 2 times in total.
Image
User avatar
StarBootics
Addict
Addict
Posts: 984
Joined: Sun Jul 07, 2013 11:35 am
Location: Canada

Re: Joystick Axis

Post by StarBootics »

@Bananenfreak

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

Best regards
StarBootics
The Stone Age did not end due to a shortage of stones !
User avatar
Bananenfreak
Enthusiast
Enthusiast
Posts: 519
Joined: Mon Apr 15, 2013 12:22 pm

Re: Joystick Axis

Post 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?
Image
Post Reply