Visual Basic > Graphics Games Programming
Getting Input from the Joystick
Getting Input from the Joystick Declare Function joyGetPos Lib "winmm.dll" _ (ByVal uJoyID As Long, pji As JOYINFO) As Long Type JOYINFO wXpos As Long wYpos As Long wZpos As Long wButtons As Long End Type Public Function GetJSValues(x As Long, y As Long, _ z As Long, Button1 As Boolean, Button2 As Boolean, _ Button3 As Boolean, Button4 As Boolean) 'Get access to the Type JOYINFO. Dim pos As JOYINFO 'Get the x, y and z values. x = pos.wXpos y = pos.wYpos z = pos.wZpos 'Get the status of the Buttons. Button1 = pos.wButtons And 1 Button2 = pos.wButtons And 2 Button3 = pos.wButtons And 4 Button4 = pos.wButtons And 8 'Follow the pattern above to get other buttons. End Function
Visual Basic Codes
ActiveX
Miscellaneous
Applications
Code Snippets
Common Dialogs
Special Effects
Database Stuff
Date Time
Files Drives
Forms
Graphics Games
Internet Stuff
Multimedia
Other
Strings
Windows