s.loc.x = outRegs.w.cx; s.loc.y = outRegs.w.dx; s.buttons = outRegs.w.bx;
}
void moveMouseCursor ( const Point p ) {
union REGS inRegs, outRegs;
jnRegs.w.ax = 4; inRegs.w.cx = p.x; inRegs.w.dx = p.y;
int386 ( 0x33, &inRegs, &outRegs );
}
void setHorzMouseRange ( int xmin, int xmax ) {
union REGS inRegs, outRegs;
JnRegs.w.ax = 7; inRegs.w.cx = xmin; inRegs.w.dx = xmax;
int386 ( 0x33, &inRegs, &outRegs );
void setVertMouseRange ( int ymin, int ymax )
union REGS inRegs, outRegs;
JnRegs.w.ax = 8; inRegs.w.cx = ymin; inRegs.w.dx - ymax;
j int386 ( 0x33, &inRegs, &outRegs );
void setMouseShape ( const CursorShape& c )

Компьютерная графика. Полигональные модели

{
union REGS inRegs, outRegs; struct SREGS segRegs;
segread ( &segRegs );
inRegs.w.ax = 9;
inRegs.w.bx = c.hotSpot.x;
inRegs.w.cx = c.hotSpot.y;
inRegs.x.edx = FPJDFF ( c.andMask );
segRegs.es = FP_SEG ( c.andMask );
int386x ( 0x33, &inRegs, &outRegs, &segRegs );
}
void hideMouseCursor ( const Rect& r ) {
union REGS inRegs, outRegs;
inRegs.w.ax = 0x10; inRegs.w.bx = r.xl; inRegs.w.cx = r.yl; inRegs.w.si = r.x2; inRegs.w.di = r.y2;
int386 ( 0x33, &inRegs, &outRegs );
}
#pragma off (check_stack)
static void Joadds far mouseStub ( int mask, int btn, int x, int y )
{
#pragma aux mouseStub parm [EAX] [EBX] [ECX] [EDX] (*curHandler)(mask, btn, x, y );
}
#pragma on (check_stack)
void setMouseHandler ( MouseHandler h, int mask )
{
curHandler = h;
union REGS inRegs, outRegs; struct SREGS segRegs;
segread ( &segRegs );
inRegs.w.ax = OxOC; inRegs.w.cx = (short) mask; inRegs.x.edx = FP_OFF ( mouseStub ); segRegs.es = FP_SEG ( mouseStub );
int386x ( 0x33. &inRegs, &outRegs, &segRegs );
}
void removeMouseHandler ()
{
union REGS inRegs, outRegs;
inRegs.w.ax = OxOC; inRegs.w.cx = 0;

4. Работа с основными графическими устройствами

int386 ( 0x33, &inRegs, &outRegs ); curHandler = NULL;
}

4.3. Джойстик Еще одним устройством, часто используемым для ввода графической информации (обычно в игровых программах), является джойстик.


⇐ Предыдущая| |Следующая ⇒