Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

AppGameKit Classic Chat / Xbox360 Controller - can't find second joystick or triggers...

Author
Message
DavidAGK
AGK Developer
10
Years of Service
User Offline
Joined: 1st Jan 2014
Location:
Posted: 9th Oct 2014 20:17
Hi All,

Just got a PC XBOX360 controller for my platform game that I'm working on. Just done a mini program to see how it works and I can only find the left hand joystick. The right hand one doesn't seem to exist. All the buttons seem present apart from the two triggers. I've not installed the sw that came with it yet...but wondered if anyone else had one of these controllers and whether you'd managed to get both joysticks and the triggers working.

I've done the CompleteRawJoystickDetection() command and then printed to the screen the value of GetRawJoystickX(number) where number is 0,1,2,3,4 etc but only 1 seems to find values.

I don't want to have to chop off one of my thumbs because it has no use.
Digital Awakening
AGK Developer
22
Years of Service
User Offline
Joined: 27th Aug 2002
Location: Sweden
Posted: 9th Oct 2014 20:23
The 360 controllers doesn't work well with AGK. I have brought it up on a number of occasions. Hopefully Paul will get support for them worked in after v2.

I don't remember if I have tried the right stick. The triggers doesn't report back correctly. I also cannot get anything from the d-pad. I am using a 3rd party wireless receiver and regular wireless 360 controllers. With proper drivers installed.

DavidAGK
AGK Developer
10
Years of Service
User Offline
Joined: 1st Jan 2014
Location:
Posted: 9th Oct 2014 21:09
Oh man! I thought it would be the best supported cpmtroller! That's a shame. It must be one of the most common controller I should imagine for PC gamers.

Hopefully it'll make it into V2.
fog
21
Years of Service
User Offline
Joined: 5th Oct 2003
Location: Newcastle, England
Posted: 9th Oct 2014 22:35 Edited at: 9th Oct 2014 22:36
Quote: "I've done the CompleteRawJoystickDetection() command and then printed to the screen the value of GetRawJoystickX(number) where number is 0,1,2,3,4 etc but only 1 seems to find values."


Once you've done your CompleteRawJoystickDetection() you should check which of the 4 possible indexes your joypad is using:

for t=1 to 4
if GetRawJoystickExists( t ) =1 then CurrentJoystick = t
next t

This will usually be 1, but if you have multiple devices plugged in it could be a different number. Also if you want to do local multiplayer then this is how you find out the indexes of the different player controllers.

You then use this index in all of your RawJoystick commands. ie: GetRawJoystickX( CurrentJoystick )


Some XBox360 pad info....

The d-pad is the only thing that doesn't work at all.

You might be able to use the triggers depending on what you want to do. They are analogue so return a float value and don't work with the Button commands. Unfortunately They both share the same register so it's pretty much impossible to use both at the same time.

The value can be read using:

float TriggerVal = GetRawJoystickZ( CurrentJoystick )


For the two analogue stick use:

float LStickX = GetRawJoystickX( CurrentJoystick )
float LStickY = GetRawJoystickY( CurrentJoystick )

float RStickX = GetRawJoystickRX( CurrentJoystick )
float RStickY = 0 - GetRawJoystickRY( CurrentJoystick )


Hopefully that's right. It's a while since I used Basic.

unlikely
12
Years of Service
User Offline
Joined: 5th Mar 2012
Location: Ohio, USA
Posted: 10th Oct 2014 05:11
On Mac, I'm able to get everything working easily, including D-Pad. I believe it's due to AppGameKit using DirectInput on Windows), which Microsoft has stated will never completely support the Xbox 360 controller. They want devs to switch to the new XInput for that... AFAIK.
DavidAGK
AGK Developer
10
Years of Service
User Offline
Joined: 1st Jan 2014
Location:
Posted: 10th Oct 2014 12:01
Ooh, the irony of a MS controller working perfectly on Mac but not windows. Same old BS with MS.

Cheers Fog - I've tried but only joystick 1 registers and so you only get values from that one stick. I'm assuming that multiple joysticks on one controller still register as different joystick indices?

So will V2 support InputX?
fog
21
Years of Service
User Offline
Joined: 5th Oct 2003
Location: Newcastle, England
Posted: 10th Oct 2014 13:41
Quote: "Cheers Fog - I've tried but only joystick 1 registers and so you only get values from that one stick. I'm assuming that multiple joysticks on one controller still register as different joystick indices?"
No, two analogues on the same controller both come from the same joystick indices.

As above, if your controller is using index 1 then this should give you values for both the right and left analogues (note the different commands for each stick):

float LStickX = GetRawJoystickX( 1 )
float LStickY = GetRawJoystickY( 1 )

float RStickX = GetRawJoystickRX( 1 )
float RStickY = 0 - GetRawJoystickRY( 1 )

DavidAGK
AGK Developer
10
Years of Service
User Offline
Joined: 1st Jan 2014
Location:
Posted: 10th Oct 2014 17:14
Aaaah..OK, brilliant - I'll give that a go tonight!

Thanks for bearing with me! I looked through your code but missed the critical part of GetRawJoystickX Vs GetRawJoystickRX!!!! Clearly not a natural born coder! LOL
unlikely
12
Years of Service
User Offline
Joined: 5th Mar 2012
Location: Ohio, USA
Posted: 10th Oct 2014 17:35
@David
Quote: "So will V2 support InputX? "

If I remember correctly, Paul said he's considering it, but there was some reason why that wasn't a simple thing or necessarily the best thing to do (for other support reasons.) I'm going to try to find where he mentioned it.
fog
21
Years of Service
User Offline
Joined: 5th Oct 2003
Location: Newcastle, England
Posted: 10th Oct 2014 17:59
Quote: "Thanks for bearing with me! I looked through your code but missed the critical part of GetRawJoystickX Vs GetRawJoystickRX!!!! Clearly not a natural born coder! LOL "
No problem. I realised that it was very easy to miss the different commands which is why I mentioned it on the last post.

DavidAGK
AGK Developer
10
Years of Service
User Offline
Joined: 1st Jan 2014
Location:
Posted: 10th Oct 2014 22:03
Bang on! Works perfectly... Even the triggers work to an extent as one trigger goes 0 to -1 on one side and 0 to 1 on the other, so whilst they can't be used together (they cancel each other out) you can distinguish between the two.

Really appreciate your help fog. Having just got the controller I was rather disappointed to find only one stick registering...Hmm, now to figure out a good control method for my game!

Cheers, and have a good weekend.

Login to post a reply

Server time is: 2024-11-25 10:52:26
Your offset time is: 2024-11-25 10:52:26