home *** CD-ROM | disk | FTP | other *** search
/ C/C++ Users Group Library 1996 July / C-C++ Users Group Library July 1996.iso / vol_400 / 427_01 / testware / joytest.pas < prev    next >
Encoding:
Pascal/Delphi Source File  |  1994-03-23  |  1.7 KB  |  86 lines

  1. program multijoy_test;
  2.  
  3.  
  4. uses crt,
  5.      dos,
  6.      minijoy;
  7.  
  8.  
  9. procedure hit;
  10. (* indicate that a stick is newly pushed into the respective direction *)
  11. begin
  12.   write ('█');
  13.   sound (440);
  14.   delay (10);
  15.   nosound;
  16. end;
  17.  
  18.  
  19. procedure init_screen;
  20. (* initializes screen *)
  21. var i : byte;
  22. begin
  23.   clrscr;
  24.   gotoxy (1, 24);
  25.   writeln ('Press ESC to quit');
  26.   for i:=1 to 6 do begin
  27.     gotoxy(i*10 - 2,3);
  28.     write('Joy ',i);
  29.   end;
  30. end;
  31.  
  32.  
  33. var i : byte;
  34. (* multijoy_test *)
  35. begin
  36.   repeat
  37.     init_screen;
  38.     while not keypressed do begin
  39.       GetAllJoyState;
  40.       for i:=1 to 6 do begin
  41.         with JoyState[i] do begin
  42.  
  43.           gotoxy(i*10,5);
  44.           if uhit
  45.             then hit
  46.             else if y = - 1 then write ('^')
  47.                             else write (' ');
  48.  
  49.           gotoxy(i*10-1,6);
  50.           if lhit
  51.             then hit
  52.             else if x = - 1 then write ('<')
  53.                             else write (' ');
  54.  
  55.           write(' ');
  56.  
  57.           if rhit
  58.             then hit
  59.             else if x = 1 then write ('>')
  60.                           else write (' ');
  61.  
  62.           gotoxy(i*10,7);
  63.           if dhit
  64.             then hit
  65.             else if y = 1 then write ('v')
  66.                           else write (' ');
  67.  
  68.           gotoxy(i*10,9);
  69.           if khit
  70.             then hit
  71.             else if knopf then write ('K')
  72.                           else write (' ');
  73.  
  74.           gotoxy(i*10,10);
  75.           if xhit
  76.             then hit
  77.             else if xtra then write ('X')
  78.                          else write (' ');
  79.  
  80.         end;
  81.       end;
  82.     end;
  83.   until readkey = #27;
  84.   clrscr;
  85. end.
  86.