How to setup and use a Joystick or Gamepad with your truevision3D game or app. This is the new and improve version the other one had so much bugs that I did not notice. I am using a SteelSeries 3GC 12Button Dual analog Controller with Turbo.
First of all you will need to declare it in your app.
Public gameGamepad As TVGameControllers
Next you will have to place the initialize code in the start of your app to create a new instance of it
gameGamepad = New TVGameControllers gameGamepad.Item(0).Initialize()
Now comes the fun part using it! your input routine were ever you want to put it should have this code in it but tweaked for your your own app. This is what I did.
If gameGamepad.Item(0).GetButtonState(2) = True Then 'buttons on pad or joy Else End If 'D-Pad If gameGamepad.Item(0).GetControllerStateAdvanced.PointOfView0 = 0 Then 'up inpUPp1 = True Else inpUPp1 = False End If If gameGamepad.Item(0).GetControllerStateAdvanced.PointOfView1 = 9000 Then 'right inpRightp1 = True Else inpRightp1 = False End If If gameGamepad.Item(0).GetControllerStateAdvanced.PointOfView2 = 18000 Then 'down inpDownp1 = True Else inpDownp1 = False End If If gameGamepad.Item(0).GetControllerStateAdvanced.PointOfView3 = 27000 Then 'left inpLeftp1 = True Else inpLeftp1 = False End If If gameGamepad.Item(0).GetControllerStateAdvanced.PointOfView0 = 4500 Then inpUPp1 = True inpRightp1 = True Else inpUPp1 = False inpRightp1 = False End If If gameGamepad.Item(0).GetControllerStateAdvanced.PointOfView0 = 13500 Then 'right-down inpRightp1 = True inpDownp1 = True Else inpRightp1 = False inpDownp1 = False End If If gameGamepad.Item(0).GetControllerStateAdvanced.PointOfView0 = 22500 Then 'down-left inpDownp1 = True inpLeftp1 = True Else inpDownp1 = False inpLeftp1 = False End If If gameGamepad.Item(0).GetControllerStateAdvanced.PointOfView0 = 31500 Then 'up-left inpLeftp1 = True inpUPp1 = True Else inpLeftp1 = False inpUPp1 = False End If ' Left Analog Stick If gameGamepad.Item(0).GetControllerStateAdvanced.x < 5000 Then 'left inpLeftp1 = True Else inpLeftp1 = False End If If gameGamepad.Item(0).GetControllerStateAdvanced.x > 5000 Then 'right inpRightp1 = True Else inpRightp1 = False End If If gameGamepad.Item(0).GetControllerStateAdvanced.y < 5000 Then 'up inpUPp1 = True Else inpUPp1 = False End If If gameGamepad.Item(0).GetControllerStateAdvanced.y > 5000 Then 'down inpDownp1 = True Else inpDownp1 = False End If ' Right Analog Stick If gameGamepad.Item(0).GetControllerStateAdvanced.rotationz < 5000 Then End If If gameGamepad.Item(0).GetControllerStateAdvanced.rotationz > 5000 Then End If If gameGamepad.Item(0).GetControllerStateAdvanced.z < 5000 Then End If If gameGamepad.Item(0).GetControllerStateAdvanced.z > 5000 Then End If
Side not for the left and right analog sticks: All values are 5000 greater or less than. This is the analogs range of motion from 0 to 5000 and 0 to -5000. You can make it so if you have like 2500 if you want different speeds depending on how far you have the stick pushed but that’s up to you to decide.
Side not for the D-Pad or Directional Pad all values are 9000 and to do the next direction it would be 9000 + 9000. For any diagonal it would be 1/2. As you can see above in the code.
D-Pad Values up = 0 down = 18000 left = 27000 right = 9000 up right = 4500 right down 13500 down left 22500 up left = 31500 no press = -1
I hope this page will help others as I just relearned how to do this and fixed the errors from the old version to make this new and improved one. Its the basics and it works.