uses Graph, Crt;
var
grDriver: Integer;
grMode: Integer;
ErrCode: Integer;
button,x,y,z, mouse_keys: word;
mouse_X, mouse_Y:word;
function mouse_init: boolean;
var
m:boolean;
begin asm
mov ax,0
int 33h
mov @Result, al
end;
end;
procedure mouse_on;
begin asm
mov ax,1
int 33h
end;
end;
procedure mouse_off;
begin asm
mov ax,2
int 33h
end;
end;
procedure mouse_get(var m_k:word; var m_x:word; var m_y:word);
begin asm
mov ax,3
int 33h
les di, m_k
mov es:[di], bx
les di, m_x
mov es:[di], cx
les di, m_y
mov es:[di], dx
end;
end;
procedure first;
begin
setcolor (green);
circle (265,225,35);
setcolor (red);
if (x<265) and (y>225) then begin cleardevice ; circle (250,244,8); {lev. niz} end;
if (x>265) and (y>225) then begin cleardevice ; circle (280,244,8); {prav. niz} end;
if (x<265) and (y<225) then begin cleardevice ;circle (250,204,8); {lev. verh} end;
if (x>265) and (y<225) then begin cleardevice ;circle (280,204,8); {prav. verh} end;
end;
procedure second;
begin
setcolor (green);
circle (335,225,35);
setcolor (red);
if (x<335) and (y>225) then begin cleardevice ; circle (320,244,8); end;
if (x>335) and (y>225) then begin cleardevice ;circle (350,244,8); end;
if (x<335) and (y<225) then begin cleardevice ;circle (320,204,8)end;
if (x>335) and (y<225) then begin cleardevice ;circle (350,204,8); end;
end;
begin
grDriver := VGA;
grMode := VGAhi;
InitGraph(grDriver, grMode,' ');
ErrCode := GraphResult;
if ErrCode = grOk then
begin
setcolor(green);
SetLineStyle(10, 10 ,10);
mouse_on;
setcolor(red);
SetLineStyle(10, 10 ,10);
repeat
mouse_on;
mouse_get(button, x,y);
first;
second;
until Keypressed;
CloseGraph;
end
else
Writeln('Error:', GraphErrorMsg(ErrCode));
end.
Мышка+Графика |