Forum

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.

Moderator: InsideQC Admins

xInput (xbox360 controller) in quake engines

Postby Barnes » Sun May 07, 2017 11:36 am

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...)?
User avatar
Barnes
 
Posts: 216
Joined: Thu Dec 24, 2009 2:26 pm
Location: Russia, Moscow

Re: xInput (xbox360 controller) in quake engines

Postby Spike » Sun May 07, 2017 3:55 pm

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.
Spike
 
Posts: 2845
Joined: Fri Nov 05, 2004 3:12 am
Location: UK

Re: xInput (xbox360 controller) in quake engines

Postby mh » Mon May 08, 2017 10:21 pm

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
User avatar
mh
 
Posts: 2282
Joined: Sat Jan 12, 2008 1:38 am

Re: xInput (xbox360 controller) in quake engines

Postby Barnes » Sun May 21, 2017 4:44 pm

now all work fine
tnx :wink:
User avatar
Barnes
 
Posts: 216
Joined: Thu Dec 24, 2009 2:26 pm
Location: Russia, Moscow


Return to General Programming

Who is online

Users browsing this forum: Yahoo [Bot] and 1 guest