home *** CD-ROM | disk | FTP | other *** search
/ Turbo Toolbox / Turbo_Toolbox.iso / 1988 / 03 / mausdemo.pas < prev    next >
Encoding:
Pascal/Delphi Source File  |  1987-12-10  |  1.9 KB  |  63 lines

  1. PROGRAM Maus_Demo;
  2. CONST
  3.   buttons : ARRAY[0..7] OF STRING[20] =
  4.             ('keine', 'links', 'rechts', 'links+rechts',
  5.              'mitte', 'mitte+links', 'mitte+rechts',
  6.              'mitte+links+rechts');
  7. VAR
  8.   n, x, y, button  : INTEGER;
  9.   textmodus, again : BOOLEAN;
  10.  
  11. (*$I MAUS.PAS *)
  12.  
  13. BEGIN
  14.   ClrScr;  textmodus := TRUE;  n := Init_Mouse;
  15.   IF n > 0 THEN BEGIN
  16.     Set_Mouse(6, 8, TRUE);  Set_Mouse_Speed(3);
  17.     Set_Mouse_XY(1, 2, 80, 25, TRUE);
  18.     REPEAT
  19.       ClrScr;  again := FALSE;
  20.       IF textmodus THEN BEGIN
  21.         TextMode;  Text_Mouse(#1, White, Black);
  22.       END
  23.       ELSE BEGIN
  24.         HiRes;  Graphic_Mouse(1, 1, M_Arrow);
  25.       END;
  26.       GotoXY(30, 14);
  27.       Write('Die Maus hat ', n, ' Tasten');
  28.       Show_Mouse;
  29.       GotoXY(75, 25);  LowVideo;  Write('ENDE');
  30.       GotoXY(3, 10);  Write('BEEP AN');
  31.       GotoXY(6, 18);  Write('BEEP AUS');  GotoXY(50, 5);
  32.       CASE textmodus OF
  33.         TRUE  : Write('in den Grafik-Modus');
  34.         FALSE : Write('in den Text-Modus');
  35.       END;
  36.       NormVideo;
  37.       REPEAT
  38.         GotoXY(1, 1);
  39.         Get_Mouse(x, y, button, textmodus);
  40.         Write(x, '  ', y, '  ',
  41.               buttons[button], '          ');
  42.         Wait_Mouse;
  43.         IF Mouse_in_XY(3, 10, 9, 10, TRUE) THEN BEGIN
  44.           Text_Mouse(#14, Random(White)+Blink, Red);
  45.           Sound(100+Random(500));
  46.         END;
  47.         IF Mouse_in_XY(6, 18, 13, 18, TRUE) THEN BEGIN
  48.           Text_Mouse(Chr(1+Random(2)),Random(White),Cyan);
  49.           NoSound;
  50.         END;
  51.         IF Mouse_in_XY(50, 5, 62, 5, TRUE) THEN BEGIN
  52.           textmodus := NOT textmodus;  again := TRUE;
  53.           Set_Mouse(50, 7, TRUE);
  54.         END;
  55.       UNTIL (Button_Pressed AND
  56.              Mouse_in_XY(75, 25, 78, 25, TRUE)) OR again;
  57.     UNTIL NOT again;
  58.     Hide_Mouse;
  59.   END
  60.   ELSE Write('Keine Maus initialisiert');
  61.   TextMode;
  62. END.
  63.