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.

Code Snippets / [DBP] Xbox 360 Controller Code sample with an actual demo

Author
Message
CSL
15
Years of Service
User Offline
Joined: 22nd Mar 2009
Location: USA
Posted: 10th Apr 2009 01:49 Edited at: 12th Apr 2009 04:24
I've seen a few code samples that simply read the Xbox 360 controller, but none provide practical applications. There are a lot of unanswered questions on how to apply these values to an actual game.

I've included a code snippet that uses the Xbox 360 controller to move a circle around the screen in all directions. It may be a better starting point in deciphering this controller.

I noticed that my controller's x,y values on the left stick are never the same when in an idle position, so I had to come up with a range of x and y idle values (xlo, xhi, ylo, yhi). You may need to adjust these values for your controller. It would be great if someone would add a calibration routine.



No media required.

CSL
Crazy Ninja
19
Years of Service
User Offline
Joined: 27th Aug 2005
Location: Awesometon
Posted: 16th Apr 2009 21:58
Pretty nice, I'll look at this more in depth later if i want to implement this into my game.
El Goorf
18
Years of Service
User Offline
Joined: 17th Sep 2006
Location: Uni: Manchester, Home: Dunstable
Posted: 1st May 2009 19:17
just what i needed, thanks.

http://notmybase.com
All my base are not belong to anyone.
hookkshot
17
Years of Service
User Offline
Joined: 12th Apr 2007
Location: Adelaide, Aus
Posted: 16th Jun 2009 13:53
I'll give it a try and see what happens i reckon

2.0Gh AM2 Processor, 9800GT, 2Gb Ram

Login to post a reply

Server time is: 2024-11-22 01:32:47
Your offset time is: 2024-11-22 01:32:47