summary refs log tree commit diff
path: root/src/MacInput.cpp
blob: 5b7aedaeb3981bdc6d5a6131f79da323633fe21d (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
/**> HEADER FILES <**/
#include "MacInput.h"

/**> Mouse Stuff <**/
#ifdef OS9
CursorDevicePtr	theCursor;
#endif

/********************> IsKeyDown() <*****/
Boolean	IsKeyDown( unsigned char *keyMap, unsigned short theKey )
{
	long	keyMapIndex;
	Boolean	isKeyDown;
	short	bitToCheck;

	// Calculate the key map index
	keyMapIndex = keyMap[theKey/8];

	// Calculate the individual bit to check
	bitToCheck = theKey%8;

	// Check the status of the key
	isKeyDown = ( keyMapIndex >> bitToCheck ) & 0x01;

	// Return the status of the key
	return isKeyDown;
}

#ifdef OS9
void 	InitMouse()
{
	CursorDeviceNewDevice( &theCursor ); //Mouse
}

void 	MoveMouse(int xcoord, int ycoord, Point *mouseloc)
{
	CursorDeviceMoveTo( theCursor, xcoord, ycoord);
	GetMouse(mouseloc);
}

void DisposeMouse()
{
	CursorDeviceDisposeDevice( theCursor );//Mouse
}
#endif