This guide will get you started using a 360 controller in DBPro with much simpler results.
It's a modified code of 'Elite Gamings' original map out for the wired 360 controller. Credit to him!
Notes:
Some input, due to math, is limited to a 9 where it should be 10 on the joystick x or y for the right joystick. Not a big deal, but yeah.
Step 1
Download and install this driver from Microsoft.com
http://www.microsoft.com/downloads/details.aspx?FamilyID=0e989b12-576b-42f2-b7c1-2a17ce25188b&DisplayLang=en
Step 2
Plug your controller into the USB input in your computer.
Go through the new hardware installation as usual, choosing 'Install Hardware Automatically' and eventually the hardware will find itself and install
Step 3
Copy the following commented code into DBPro and check if the variables are read through the joystick commands. They should, and if it works, read through the code and variable set up so you know how to take control of the controller input.
`|------------------------------------------|
`|--------------------||--------------------|
`|--------| Xbox360 Controller Map |--------|
`|--------| created by |--------|
`|--------| Xenocythe of XenMedia |--------|
`|--------| (xenmedis.org) |--------|
`|--------------------||--------------------|
`|--------------------||--------------------|
`|------------------------------------------|
`Sync On
Sync On
`These three lines simply turn the backdrop on for sync, naturally through 3D
`I then delete the cube I make because I dont need it, and I color the background black
make object cube 1,1
delete object 1
color backdrop 0
`Here I set up all of the variables you can use to take input from your 360 controller
`I named them appropriately
`The DPad variables are slightly more complex, but I made it so you can use the DPad easier
Global LeftStickX
Global LeftStickY
Global LeftStickPress
Global LeftTrigger
Global LeftShoulderPress
Global RightStickX
Global RightStickY
Global RightStickPress
Global RightTrigger
Global RightShoulderPress
Global StartButton
Global BackButton
Global AButton
Global XButton
Global YButton
Global BButton
Type DPadMap
State as integer
StateName as string
EndType
Global Dim DPad(9) as DPadMap
DPad(1).State=(-1) : DPad(1).StateName="UnPressed"
DPad(2).State=(4500) : DPad(2).StateName="UpRight"
DPad(3).State=(9000) : DPad(3).StateName="Right"
DPad(4).State=(13500) : DPad(4).StateName="BottomRight"
DPad(5).State=(18000) : DPad(5).StateName="Bottom"
DPad(6).State=(22500) : DPad(6).StateName="BottomLeft"
DPad(7).State=(27000) : DPad(7).StateName="Left"
DPad(8).State=(31500) : DPad(8).StateName="UpLeft"
DPad(9).State=(0) : DPad(9).StateName="Up"
Global DPadPressed
Do
`--------------------------------------------------------------------------------------------
`Now I just use some math and basic commands to manipulate input values
`I do this to make everything much simpler for you to handle with your controller
LeftStickX = JoyStick X()*.01
LeftStickY = -JoyStick Y()*.01
LeftStickPress = JoyStick Fire X(8)
If JoyStick Z()>0 : LeftTrigger = abs(JoyStick Z())*.01 : ELSE : LeftTrigger = 0 : EndIf
LeftShoulderPress = JoyStick Fire X(4)
RightStickX = ((0-1000)+((JoyStick Twist X()/65.535)*2))*.01
RightStickY = (1000-((JoyStick Twist Y()/65.535)*2))*.01
RightStickPress = JoyStick Fire X(9)
If JoyStick Z()<0 : RightTrigger = abs(JoyStick Z())*.01 : ELSE : RightTrigger = 0 : EndIf
RightShoulderPress = JoyStick Fire X(5)
StartButton = JoyStick Fire X(7)
BackButton = JoyStick Fire X(6)
AButton = JoyStick Fire A()
XButton = JoyStick Fire C()
YButton = JoyStick Fire D()
BButton = JoyStick Fire B()
For x = 1 to 9
If JoyStick Hat Angle(0) = DPad(x).State : DPadPressed = x : EndIf
Next x
`--------------------------------------------------------------------------------------------
`--------------------------------------------------------------------------------------------
`This text will show on screen when you run the program
`You can play around with your controller and see how the variables respond in simple numbers
Text 10, 10, "Left JoyStick X: " + Str$(LeftStickX)
Text 10, 20, "Left JoyStick Y: " + Str$(LeftStickY)
Text 10, 30, "Left JoyStick Click: " + Str$(LeftStickPress)
Text 10, 40, "Left Trigger: " + Str$(LeftTrigger)
Text 10, 50, "Left Shoulder Button: " + Str$(LeftShoulderPress)
Text 10, 70, "Right JoyStick X: " + Str$(RightStickX)
Text 10, 80, "Right JoyStick Y: " + Str$(RightStickY)
Text 10, 90, "Right JoyStick Click: " + Str$(RightStickPress)
Text 10, 100, "Right Trigger: " + Str$(RightTrigger)
Text 10, 110, "Right Shoulder Button: " + Str$(RightShoulderPress)
Text 10, 130, "Start Button: " + Str$(StartButton)
Text 10, 140, "Back Button: " + Str$(BackButton)
Text 10, 160, "A Button: " + Str$(AButton)
Text 10, 170, "X Button: " + Str$(XButton)
Text 10, 180, "Y Button: " + Str$(YButton)
Text 10, 190, "B Button: " + Str$(BButton)
`To control your dpad, check the variable DPadPressed and the array at the top
Text 10, 210, "D-Pad: " + DPad(DPadPressed).StateName
`--------------------------------------------------------------------------------------------
Sync
Loop
If, for some reason, the code does not work correctly and you dont see any input through variables in the program when run, post here and I will look into it.
From here on out it should be very easy to use this code to take input from your wired xbox360 controller with DBPro.
Have fun,
Xeno
3.11 We do not tolerate posts made for the purpose of putting down another forum member, group of members, religion, our company, our staff or any of our moderators, past or present.