home *** CD-ROM | disk | FTP | other *** search
/ io Programmo 23 / IOPROG_23.ISO / SOFT / DELPHIX.ZIP / Samples / Input / FFMachineGun / Main.pas < prev    next >
Encoding:
Pascal/Delphi Source File  |  1998-10-06  |  947 b   |  43 lines

  1. unit Main;
  2.  
  3. interface
  4.  
  5. uses
  6.   Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  7.   StdCtrls, ExtCtrls, DXInput;
  8.  
  9. type
  10.   TMainForm = class(TForm)
  11.     Timer: TTimer;
  12.     DXInput1: TDXInput;
  13.     Label1: TLabel;
  14.     procedure TimerTimer(Sender: TObject);
  15.   private
  16.     FOldStates: TDXInputStates;
  17.   end;
  18.  
  19. var
  20.   MainForm: TMainForm;
  21.  
  22. implementation
  23.  
  24. {$R *.DFM}
  25.  
  26. procedure TMainForm.TimerTimer(Sender: TObject);
  27. begin
  28.   DXInput1.Update;
  29.             
  30.   if (isButton1 in DXInput1.States) and (not (isButton1 in FOldStates)) then
  31.   begin
  32.     DXInput1.Joystick.Effects.Find('Machine gun').Start;
  33.   end else                                             
  34.   if (not (isButton1 in DXInput1.States)) and (isButton1 in FOldStates) then
  35.   begin
  36.     DXInput1.Joystick.Effects.Find('Machine gun').Stop;
  37.   end;                                               
  38.  
  39.   FOldStates := DXInput1.States;
  40. end;
  41.  
  42. end.
  43.