Subject: mouse support for demo.

From: "Russell Nelson" <[email-masked]>
Date: Sat, 08 Feb 1992 18:13:46 EST

Here's a rudimentary mouse support package for the rend386 demo.  It
took me 20 minutes to hack up, so you can be sure that I'll be
improving it.  It replaces joystick.obj in userint.lib.  Install it
like this:

bcc -c -ml joymouse.c
tlib userint-*joystick
tlib userint+joymouse
make

All four combinations of the left and right buttons (no middle button
support yet) does something different, just like the joystick.  The
scale isn't quite right, I'll have to fix that too.  Anyway, it sure
beats pressing arrow keys.

#include <dos.h>
#include "userint.h"

static int mouse(void)
{
	geninterrupt(0x33);
	return _AX;
}

/* joystick_check() -- returns non-zero if joysticks are found; bit zero for
   joystick 1, bit 1 for joystick 2
*/
int joystick_check(){
	_AX = 0;
	if (mouse()) return 1;
	return 0;
}

/* joystick_init(joydata, port) -- initializes the joystick; port 0 for joystick
   1, port 1 for joystick 2; this routine assume the joystick is at center
*/
void joystick_init(joystick_data *joy, int port){
}

/* joystick_read(joydata) -- reads current position and button values */
int joystick_read(joystick_data *joystick){
	int bx;

	_AX = 3;
	mouse();
	bx = _BX;
	joystick->buttons = bx;
	_AX = 0xb;
	mouse();
	joystick->x = -_CX;
	joystick->y = _DX;
}

/* joystick_quit() -- shuts down joystick operation */
void joystick_quit(){
}

/* joystick_setscale(joydata, scale) -- sets maximum range of X or Y values
*/
void joystick_setscale(joystick_data *joy, int value){
}

/* joystick_scale(joydata, dir) -- if dir == 0, marks top-left, else bottom-right
*/
void joystick_scale(joystick_data *joy, int dir){
}
-- 
-russ <[email-masked]>  I'm proud to be a humble Quaker!