Update of /cvsroot/win32forth/win32forth/src/lib
In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv13520/src/lib
Modified Files:
Joystick.f
Log Message:
Jos: Added: joyGetPosEx to complete the source.
Index: Joystick.f
===================================================================
RCS file: /cvsroot/win32forth/win32forth/src/lib/Joystick.f,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** Joystick.f 27 May 2006 15:13:36 -0000 1.1
--- Joystick.f 30 May 2006 09:40:48 -0000 1.2
***************
*** 46,66 ****
:struct joyinfoex
! DWORD dwSize; /* size of structure */
! DWORD dwFlags; /* flags to indicate what to return */
! DWORD dwXpos; /* x position */
! DWORD dwYpos; /* y position */
! DWORD dwZpos; /* z position */
! DWORD dwRpos; /* rudder/4th axis position */
! DWORD dwUpos; /* 5th axis position */
! DWORD dwVpos; /* 6th axis position */
! DWORD dwButtons; /* button states */
! DWORD dwButtonNumber; /* current button number pressed */
! DWORD dwPOV; /* point of view state */
! DWORD dwReserved1; /* reserved for communication between winmm & driver */
! DWORD dwReserved2; /* reserved for future expansion */
;struct
sizeof joyinfoex mkstruct: *lpjoyinfoex
: GetJoystickInfo ( id -- x y z buttons )
*lpjoyinfo [ sizeof joyinfo ] literal erase
--- 46,97 ----
:struct joyinfoex
! DWORD dwSize /* size of structure */
! DWORD dwFlags /* flags to indicate what to return */
! DWORD dwXpos /* x position */
! DWORD dwYpos /* y position */
! DWORD dwZpos /* z position */
! DWORD dwRpos /* rudder/4th axis position */
! DWORD dwUpos /* 5th axis position */
! DWORD dwVpos /* 6th axis position */
! DWORD dwButtons /* button states */
! DWORD dwButtonNumber /* current button number pressed */
! DWORD dwPOV /* point of view state */
! DWORD dwReserved1 /* reserved for communication between winmm & driver */
! DWORD dwReserved2 /* reserved for future expansion */
;struct
sizeof joyinfoex mkstruct: *lpjoyinfoex
+ : joyGetPosEx ( dwFlags id -- result )
+ >r [ sizeof joyinfoex ] literal
+ struct, *lpjoyinfoex joyinfoex dwSize !
+ struct, *lpjoyinfoex joyinfoex dwFlags !
+ *lpjoyinfoex r> call joyGetPosEx
+ ;
+
+
+ (( About joyGetPosEx:
+ The information returned from joyGetPosEx depends on the flags you specify in dwFlags.
+
+ Result JOYERR_NOERROR if successful or one of the following error values.
+
+ Value Description
+ MMSYSERR_NODRIVER The joystick driver is not present.
+ MMSYSERR_INVALPARAM An invalid parameter was passed.
+ Windows 95/98/Me: The specified joystick identifier is invalid.
+
+ MMSYSERR_BADDEVICEID Windows 95/98/Me: The specified joystick identifier is invalid.
+ JOYERR_UNPLUGGED The specified joystick is not connected to the system.
+ JOYERR_PARMS Windows NT/2000/XP: The specified joystick identifier is invalid.
+
+
+ Remarks
+
+ This function provides access to extended devices such as rudder pedals,
+ point-of-view hats, devices with a large number of buttons, and coordinate
+ systems using up to six axes. For joystick devices that use three axes or
+ fewer and have fewer than four buttons, use the joyGetPos function.
+ ))
+
: GetJoystickInfo ( id -- x y z buttons )
*lpjoyinfo [ sizeof joyinfo ] literal erase
***************
*** 72,76 ****
;
! 4 constant MaxJoysticks
: FindFirstJoyStick ( - *lpjoycapsa ID ) \ ID should be <= MaxJoysticks
--- 103,107 ----
;
! 15 constant MaxJoysticks
: FindFirstJoyStick ( - *lpjoycapsa ID ) \ ID should be <= MaxJoysticks
***************
*** 83,87 ****
! \s Test and demo:
: JoystickTest ( - ) \ Move the joystick and press some buttons
--- 114,118 ----
! \s Tests and demo:
: JoystickTest ( - ) \ Move the joystick and press some buttons
***************
*** 97,99 ****
--- 128,132 ----
JoystickTest
+ \ joy_returnall FindFirstJoyStick joyGetPosEx . *lpjoyinfoex sizeof joyinfoex dump
+
\s
|