xInput (xbox360 controller) in quake engines

Discuss programming topics for any language, any source base. If it is programming related but doesn't fit in one of the below categories, it goes here.
Post Reply
Barnes
Posts: 232
Joined: Thu Dec 24, 2009 2:26 pm
Location: Russia, Moscow
Contact:

xInput (xbox360 controller) in quake engines

Post by Barnes »

Some time ago i'm add based xbox360 controller support (based on directQ)
By default left and right lower triggers work as sticks, not as buttons. MH use it for strafe move.
We can map this triggers to some buttons (fire, jumps...)?
Spike
Posts: 2914
Joined: Fri Nov 05, 2004 3:12 am
Location: UK
Contact:

Re: xInput (xbox360 controller) in quake engines

Post by Spike »

the analog triggers report values between 0 and 255, yes.
just consider them pressed if they're above 128 and depressed if lower.

buttons = (uint32_t)xinput.buttons;
if (xinput.lefttrigger>127) buttons |= 0x10000;
if (xinput.righttrigger>127) buttons |= 0x20000;

and then pretend it has 18 buttons instead of 16. you can then bind it or not, and scale(via cvar) any stick movement from them to 0 or not.
mh
Posts: 2292
Joined: Sat Jan 12, 2008 1:38 am

Re: xInput (xbox360 controller) in quake engines

Post by mh »

I can't remember why I used them for strafe, although I think that the N64 version of Quake used the equivalent buttons, and I would have probably followed that lead.
We had the power, we had the space, we had a sense of time and place
We knew the words, we knew the score, we knew what we were fighting for
Barnes
Posts: 232
Joined: Thu Dec 24, 2009 2:26 pm
Location: Russia, Moscow
Contact:

Re: xInput (xbox360 controller) in quake engines

Post by Barnes »

now all work fine
tnx :wink:
Post Reply