#: 3886 S3/Languages
27-May-90 23:54:03
Sb: #3870-#C and JOoysticks
Fm: Bruce MacKenzie 71725,376
To: TONY CAPPELLINI 76370,2104 (X)
Tony,
If you have no assembly experience then I can see that you might have a bit of
trouble figuring out an _os9() call. Here's the source of a function that will
read the joystick status:
#include
_gs_joy(path,joy,but,x,y)
int path,joy,*but,*x,*y;
{
struct registers r;
r.rg_a=path;
r.rg_b=SS_JOY;
r.rg_x=joy;
if(_os9(I_GETSTT,&r)==-1)
return -1;
*but=(int)r.rg_a;
*x=r.rg_x;
*y=r.rg_y;
return 0;
}
The parameters are:
path = path number to a window or to term. Be sure not to pass a FILE
pointer. ie use fileno(stdin) and not stdin here.
joy = 0 for right joystick. 1 for left joystick.
but = pointer to an integer to receive the button status. Returns:
0 for none, 1 for button 1 down, 2 for button 2 down, 3 for both
buttons down
x =x value (0 to 63)
y = y value (0 to 63)
There is 1 Reply.
|