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 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72
| program graphinterac;
uses crt, graph;
var
driver, mode: smallint;
letter: char;
begin
driver := Detect;
mode:=0;
InitGraph(driver, mode, 'c:/Dev-Pas/BGI');
if (GraphResult <> grOk) then
begin
writeln('Erreur au cours de l''initialisation du mode graphique');
halt(1);
end;
SetFillStyle(1, red);
Bar(50, 80, 200, 100);
Bar(250, 80, 400, 100);
Bar(450, 80, 600, 100);
OutTextXY(75, 70, 'Le bouton A');
OutTextXY(275, 70, 'Le bouton B');
OutTextXY(475, 70, 'Le bouton C');
repeat
letter := readkey;
case letter of
'a', 'A':
begin
sound(250);
delay(50);
nosound;
SetFillStyle(1, blue);
Bar(50, 80, 200, 100);
delay(2000);
SetFillStyle(1, red);
Bar(50, 80, 200, 100);
end;
'b', 'B':
begin
sound(350);
delay(50);
nosound;
SetFillStyle(1, blue);
Bar(250, 80, 400, 100);
delay(2000);
SetFillStyle(1, red);
Bar(250, 80, 400, 100);
end;
'c', 'C':
begin
sound(450);
delay(50);
nosound;
SetFillStyle(1, blue);
Bar(450, 80, 600, 100);
delay(2000);
SetFillStyle(1, red);
Bar(450, 80, 600, 100);
end;
else
begin
sound(150);
delay(50);
nosound;
end;
end;
until letter = #27;
CloseGraph;
end. |
Partager