// button flags
#define MK_LEFT 0x0001
#define MK_RIGHT 0x0002
#define MKJvllDDLE 0x0004
struct MouseState {
Point,,, loc; int buttons;
};
class CursorShape
4. Работа с основными графическими устройст
{
public:
unsigned short andMask [16]; unsigned short xorMask [16]; Point hotSpot;
CursorShape ( unsigned short *, unsigned short *, const Point& );
typedef void (cdecl far * MouseHandler)( int, int, int, int);
int resetMouse ();
void showMouseCursor ();
void hideMouseCursor ();
void hideMouseCursor (const Rect& );
void readMouseState (MouseState&);
void moveMouseCursor (const Point);
void setMouseHorzRange (int, int);
void setmouseVertRange (int, int);
void setMouseShape (const CursorShape& );
void setMouseHandler ( MouseHandler, int = MOUSE_ALL_EVENTS );
void removeMouseHandler ();
#endif
// File Mouse.cpp #include <alloc.h> #include "Mouse.h"
#pragma inline
static MouseHandler curHandler = NULL;
CursorShape :: CursorShape ( unsigned short * aMask,
unsigned short * xMask, const Point& p ): hotSpot ( p )
{
for (register int i = 0; i < 16; i++ ) {
andMask [i] = aMask [i]; xorMask [i] = xMask [i];
}
}
int resetMouse ()
{
asm {
xor ax, ax int 33h
}
return AX==0xFFFF;
}
void showMouseCursor ()
Компьютерная графика. Полигональные модели
{
asm {
mov ax, 1 int 33h
>
}
void hideMouseCursor () {
asm {
mov ax, 2 int 33h
}
}
void readMouseState ( MouseState& s )
{
asm {
mov ax, 3 int 33h
}
#if defined(__COMPACT__) || defined(_J-ARGE_) || defined(__HUGE_J asm {
push es push di
les di, dword ptr s mov es:[di ], cx mov es:[di+2], dx mov es:[di+4], bx pop di pop es
}
#else
asm {
push di mov di, word ptr s mov [di ], cx mov [di+2], dx mov [di+4], bx pop di
>
#endif }
void moveMouseCursor ( const Point p )
' {
asm {
mov ax, 4 mov cx, p.x mov dx, p.y int 33h
>
}
4. Работа с основными графическими устройствам